Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow custom plist/save_image function #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions PyTexturePacker/PackerInterface/PackerInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ def _init_atlas_list(self, image_rect_list):
def _pack(self, image_rect_list):
raise NotImplementedError

def pack(self, input_images, output_name, output_path="", input_base_path=None):
def pack(self, input_images, output_name, output_path="", input_base_path=None,
save_image_func=Utils.save_image,
save_plist_func=Utils.save_plist):
"""
pack the input images to sheets
:param input_images: a list of input image paths or a input dir path
Expand Down Expand Up @@ -191,8 +193,8 @@ def pack(self, input_images, output_name, output_path="", input_base_path=None):
if self.reduce_border_artifacts:
packed_image = Utils.alpha_bleeding(packed_image)

Utils.save_plist(packed_plist, os.path.join(output_path, "%s.plist" % texture_file_name))
Utils.save_image(packed_image, os.path.join(output_path, "%s%s" % (texture_file_name, self.texture_format)))
save_plist_func(packed_plist, os.path.join(output_path, "%s.plist" % texture_file_name))
save_image_func(packed_image, os.path.join(output_path, "%s%s" % (texture_file_name, self.texture_format)))

def multi_pack(self, pack_args_list):
"""
Expand Down