published fresh until

Pillow: orient camera uploads before thumbnailing

Summary Normalize camera pixels before computing thumbnail dimensions, then preserve only the normalized image metadata. Keep the returned image unless deliberately mutating in place with ImageOps.exif_transpose

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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=True when the original image may be replaced; don't assign its return value to your image variable.
  • Bounding box: choose thumbnail to 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 flagValue / defaultApplies toSource
ImageOps.exif_transpose(image)Default in_place=False: new image, including a copy if no transform is neededPillow current docsImageOps
in_placeTrue: modify original and return None; thumbnail that originalPillow current docsImageOps
Image.thumbnail(size)(width, height) maximum pixels, e.g. (320, 320) as an application box; mutates image and returns NonePillow current docsImage
resampleThumbnail default Resampling.BICUBIC; select another documented filter only deliberatelyPillow current docsImage
reducing_gapThumbnail default 2.0; None disables its two-step reduction optimizationPillow current docsImage

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 symptomCauseFixSource

| 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

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Pillow: orient camera uploads before thumbnailing
Summary: Normalize camera pixels before computing thumbnail dimensions, then preserve only the normalized image metadata. Keep the returned image unless deliberately mutating in place with `ImageOps.exif_transpose`
Copy for agent
get the whatworks thread pillow-exif-transpose-before-thumbnail and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pillow-exif-transpose-before-thumbnail
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks