Call rotate_by_exif before taking image dimensions.
This commit is contained in:
parent
25678309cf
commit
5e54bb4536
1 changed files with 2 additions and 1 deletions
|
@ -32,6 +32,7 @@ def resize(
|
||||||
|
|
||||||
file = pathclass.Path(filename)
|
file = pathclass.Path(filename)
|
||||||
image = PIL.Image.open(file.absolute_path)
|
image = PIL.Image.open(file.absolute_path)
|
||||||
|
(image, exif) = imagetools.rotate_by_exif(image)
|
||||||
|
|
||||||
(image_width, image_height) = image.size
|
(image_width, image_height) = image.size
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ def resize(
|
||||||
if output_file.extension == '.jpg':
|
if output_file.extension == '.jpg':
|
||||||
image = image.convert('RGB')
|
image = image.convert('RGB')
|
||||||
|
|
||||||
image.save(output_file.absolute_path, exif=image.getexif(), quality=quality)
|
image.save(output_file.absolute_path, exif=exif, quality=quality)
|
||||||
return output_file
|
return output_file
|
||||||
|
|
||||||
def resize_argparse(args):
|
def resize_argparse(args):
|
||||||
|
|
Loading…
Reference in a new issue