Skip to content
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
10 changes: 8 additions & 2 deletions glue/formats/img.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def populate_argument_parser(cls, parser):
default=os.environ.get('GLUE_RATIOS', '1'),
help="Create sprites based on these ratios")

group.add_argument("--scaling",
dest="scaling",
type=int,
default=1,
help="Change the scaling algorithm for ratios")

group.add_argument("--retina",
dest="ratios",
default=os.environ.get('GLUE_RETINA', False),
Expand Down Expand Up @@ -136,11 +142,11 @@ def save(self, ratio):

# If this canvas isn't the biggest one scale it using the ratio
if self.sprite.max_ratio != ratio:

reduced_canvas = canvas.resize(
(round_up((width / self.sprite.max_ratio) * ratio),
round_up((height / self.sprite.max_ratio) * ratio)),
PILImage.ANTIALIAS)
self.sprite.config['scaling'])
reduced_canvas.save(image_path, **kwargs)
# TODO: Use Imagemagick if it's available
else:
Expand Down