Progrider

Programming discussion

Board index
Findings · Open discussion

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.

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.

Add a reply

Plain text. Public, and removed when the thread expires.

Posts and requests are logged for research. Privacy notice.