-
- Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
What did you do?
Tried to load image (attached below) and rotate it using image = ImageOps.exif_transpose(image)
Related to #4852 and #6123
What did you expect to happen?
Image rotated according to EXIF
What actually happened?
Processing failed with an error due to EXIF metadata being broken. Looking at exif information, I see it contains a duplicate Exif\x00\x00Exif\x00\x00 at the beginning. This image is uploaded by one of the clients, so I don't know how exactly that happened.
b'Exif\x00\x00Exif\x00\x00II*\x00\x08\x00\x00\x00\x06\x00\x12\x01\x03\x00\x01\x00\x00\x00\x01\x00\x00\x00\x1a\x01\x05\x00\x01\x00\x00\x00V\x00\x00\x00\x1b\x01\x05\x00\x01\x00\x00\x00^\x00\x00\x00(\x01\x03\x00\x01\x00\x00\x00\x02\x00\x00\x00\x13\x02\x03\x00\x01\x00\x00\x00\x01\x00\x00\x00i\x87\x04\x00\x01\x00\x00\x00f\x00\x00\x00\x00\x00\x00\x00H\x00\x00\x00\x01\x00\x00\x00H\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x90\x07\x00\x04\x00\x00\x000210\x01\x91\x07\x00\x04\x00\x00\x00\x01\x02\x03\x00\x00\xa0\x07\x00\x04\x00\x00\x000100\x01\xa0\x03\x00\x01\x00\x00\x00\xff\xff\x00\x00\x02\xa0\x04\x00\x01\x00\x00\x00\x08\x07\x00\x00\x03\xa0\x04\x00\x01\x00\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00'
exiftool shows there is error with exif
Warning : Malformed APP1 EXIF segment
What are your OS, Python and Pillow versions?
- OS: MacOS
- Python: 3.10
- Pillow: 10.2.0
Please paste here the output of running: Pillow 10.2.0 Python 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)] -------------------------------------------------------------------- Python modules loaded from /opt/homebrew/lib/python3.10/site-packages/PIL Binary modules loaded from /opt/homebrew/lib/python3.10/site-packages/PIL -------------------------------------------------------------------- --- PIL CORE support ok, compiled for 10.2.0 --- TKINTER support ok, loaded 8.6 --- FREETYPE2 support ok, loaded 2.13.3 --- LITTLECMS2 support ok, loaded 2.16 --- WEBP support ok, loaded 1.4.0 --- WEBP Transparency support ok --- WEBPMUX support ok --- WEBP Animation support ok --- JPEG support ok, compiled for libjpeg-turbo 3.0.2 --- OPENJPEG (JPEG2000) support ok, loaded 2.5.2 --- ZLIB (PNG/ZIP) support ok, loaded 1.2.12 --- LIBTIFF support ok, loaded 4.6.0 *** RAQM (Bidirectional Text) support not installed *** LIBIMAGEQUANT (Quantization method) support not installed --- XCB (X protocol) support ok image = Image.open("broken_exif.jpg") image = ImageOps.exif_transpose(image)