Skip to content

Read and clear TIFF orientation in equivalent XMP syntax - #10723

Open
Ap-95671 wants to merge 1 commit into
python-pillow:mainfrom
Ap-95671:codex/pillow-xmp-orientation-syntax
Open

Ap-95671 wants to merge 1 commit into
python-pillow:mainfrom
Ap-95671:codex/pillow-xmp-orientation-syntax

Conversation

@Ap-95671

@Ap-95671 Ap-95671 commented Dec 3, 2026

Copy link
Copy Markdown

Pillow reads TIFF orientation from XMP when EXIF does not supply it. JPEG and PNG images with valid XML such as tiff:Orientation = '6' or with whitespace around an element's orientation value currently skip the expected rotation. A multi-digit value such as 60 can also be interpreted as orientation 6.

Use the same full-value pattern for reading and clearing the orientation. Cover both JPEG XMP bytes and PNG XMP text, and verify that other XMP metadata survives transposition. The XML syntax is described in the XML attribute grammar, and Adobe lists the supported orientations in the TIFF XMP schema.

Verification on macOS with Python 3.15:

  • Five new regression cases failed on main and passed with the fix.
  • Pillow self-test: 59 passed.
  • ImageOps, JPEG, PNG, WebP, TIFF, and AVIF suites: 505 passed, 6 skipped.
  • Broad suite: 6,177 passed, 116 skipped, 14 deselected, and 3 expected failures. The headless run excluded the screen-capture test.
  • Ruff, Black, Sphinx lint, and git diff --check passed.

AI assistance: OpenAI Codex developed the patch and ran the local verification.

AI-assisted implementation and verification.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant