1
0
mirror of https://github.com/enpaul/kodak.git synced 2024-11-14 10:36:55 +00:00

Fix jpeg image autorotation issue

See also https://github.com/python-pillow/Pillow/issues/4703
See also https://github.com/huggingface/transformers/pull/14062
This commit is contained in:
Ethan Paul 2021-12-30 21:29:42 -05:00
parent 0bf2aba0ba
commit 55661034a4
No known key found for this signature in database
GPG Key ID: D0E2CBF1245E92BF

View File

@ -1,7 +1,8 @@
import logging
import peewee
from PIL import Image
import PIL.Image
import PIL.ImageOps
from kodak import configuration
from kodak import constants
@ -48,7 +49,8 @@ class ManipRecord(KodakModel):
config.content_dir / parent.name / f"{manip.name}.{format_.name.lower()}"
)
with Image.open(config.source_dir / parent.source) as image:
with PIL.Image.open(config.source_dir / parent.source) as image:
image = PIL.ImageOps.exif_transpose(image)
if manip.scale.horizontal is not None or manip.scale.vertical is not None:
image = manipulations.scale(image, manip)