File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,18 @@ def export(self):
4141 else :
4242 image = Image .open (self .source_file_path )
4343
44- if max_size :
44+ if not (max_size .get ('w' ) or max_size .get ('h' )):
45+ # If any of the dimensions for the resize aren't defined:
46+ pass
47+ else :
4548 # resize the image to the w/h maximum specified
4649 ratio = min (max_size ['w' ] / image .size [0 ], max_size ['h' ] / image .size [1 ])
4750 self .metrics .add ('ratio' , ratio )
4851 if ratio < 1 :
49- image = image .resize ((round (image .size [0 ] * ratio ),
50- round (image .size [1 ] * ratio )), Image .ANTIALIAS )
52+ image = image .resize (
53+ (round (image .size [0 ] * ratio ), round (image .size [1 ] * ratio )),
54+ Image .ANTIALIAS
55+ )
5156
5257 # Mode 'P' is for paletted images. They must be converted to RGB before exporting to
5358 # jpeg, otherwise Pillow will throw an error. This is a temporary workaround, as the
You can’t perform that action at this time.
0 commit comments