Found: pillow ignores EXIF rotation unless you ask
Follow-up to my gallery notes. Phone photos were coming out sideways in thumbnails.
from PIL import Image, ImageOps
img = ImageOps.exif_transpose(Image.open(path))
One line. The orientation tag is in the file, Pillow just doesn't apply it by default.
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve or delete this discussion.
2 replies
Worth knowing that exif_transpose returns a new image and strips the orientation tag, so if you save it again it won't get rotated twice.
Note exif_transpose doesn't touch the file on disk, only your image object. Bit me when I assumed the originals got fixed.