What this thread does
Do first: call ImageOps.exif_transpose(source) before thumbnail(size) and save the returned image rather than the unnormalized original.
Short answer
As of November 2026, Pillow 13.0.0 exposes both copy-returning and in-place normalization. ImageOps.exif_transpose applies the EXIF transform and removes the orientation information that caused it. ImageOps.
Choose / don't choose
- Returned image: choose the default when keeping the source separately; don't discard the return value and then thumbnail the source.
- In place: choose
in_place=Truewhen the original image may be replaced; don't assign its return value to your image variable. - Bounding box: choose
thumbnailto fit while retaining aspect ratio; don't expect an exact-sized crop or padded canvas.
Not for: Pillow pixel-accessor migration; see typescript-textdecoder-printer-pillow-api-boundaries.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
ImageOps.exif_transpose(image) | Default in_place=False: new image, including a copy if no transform is needed | Pillow current docs | ImageOps |
in_place | True: modify original and return None; thumbnail that original | Pillow current docs | ImageOps |
Image.thumbnail(size) | (width, height) maximum pixels, e.g. (320, 320) as an application box; mutates image and returns None | Pillow current docs | Image |
resample | Thumbnail default Resampling.BICUBIC; select another documented filter only deliberately | Pillow current docs | Image |
reducing_gap | Thumbnail default 2.0; None disables its two-step reduction optimization | Pillow current docs | Image |
Order of operations
1. Open with Image.open; keep the source available until normalization loads the pixels. 2. Call ImageOps.exif_transpose and select its returned image, or explicitly mutate in place. 3. Call thumbnail on that oriented image, then save. Example for JPEG camera input:
from PIL import Image, ImageOps
with Image.open("camera.jpg") as source:
oriented = ImageOps.exif_transpose(source)
oriented.thumbnail((320, 320))
oriented.save("thumb.jpg", exif=oriented.getexif().tobytes())
The save API accepts EXIF data; use the normalized image's EXIF, never a previously captured original EXIF blob. JPEG metadata. 4. Reopen the saved image and inspect its dimensions and getexif().get(ExifTags.Base.Orientation). Following an actual orientation transform, the tag should be absent; an unchanged identity orientation can remain 1. Check that another metadata layer has not reintroduced a nonidentity orientation. The implementation also removes corresponding XMP orientation entries. Current implementation.
Known failures and fixes
| Error or symptom | Cause | Fix | Source |
|---|
| Image variable becomes None | The in-place transform or thumbnail return was assigned as an image | Retain the mutated original; assign only the default transform's return | ImageOps, Image |
artemisart's June 18, 2021 report documents older EXIF aliasing between source and returned image. It motivates treating ownership explicitly; it does not establish a current regression.
Missing
- The linked source does not confirm: | Viewer rotates an already oriented image again | An old EXIF blob was copied back after pixel normalization | Save the normalized metadata; inspect output Orientation, not only input | transform/tag removal implementation |
- The linked source does not confirm: | Portrait thumbnail is sideways | Raw camera pixels were resized without applying their orientation metadata | Normalize first, then fit the oriented dimensions | ImageOps |
- The linked source does not confirm: Normalization must precede thumbnail sizing because a quarter-turn exchanges pixel dimensions.
- Animated/multipage inputs need a separate frame policy; this sequence targets a still camera upload.
- No fixed-in version for the historical aliasing report is asserted here. Current return/mutation behavior comes from the current API reference.
Checked
2026-11-12; Pillow 13.0.0 release, Image/ImageOps references, transform implementation and artemisart's June 2021 issue read. No image-processing commands executed.
Started from a post by @Pillow, packaged by the editor. Original post