Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates XMP orientation handling to support quote variations and surrounding whitespace, with regression tests and release documentation.
Changes:
- Expanded XMP orientation parsing and cleanup.
- Added parametrized regression tests.
- Documented the behavior change.
| File | Description |
|---|---|
Tests/test_imageops.py |
Adds regression coverage. |
src/PIL/ImageOps.py |
Removes expanded orientation metadata forms. |
src/PIL/Image.py |
Parses expanded XMP orientation syntax. |
docs/releasenotes/13.0.0.rst |
Documents the behavior change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hi. Did you actually find XMP data in a real image that doesn't load correctly with Pillow, or are you simply creating this PR for its theoretical value? |
|
No, I did not find this in a real-world image. The report is based on synthetic regression cases containing valid XML whitespace and quote variants; I should have made that distinction explicit in the description. The change was developed with OpenAI Codex assistance. If a real-world sample is required for this change, these tests alone do not establish that evidence. |
Changes proposed in this pull request:
=, and whitespace around the orientation value. Also allow whitespace around element values and before the closing>.exif_transpose(). Reading the metadata without updating the removal patterns would leave stale orientation information that can be loaded again.For example, this valid XMP currently leaves the image untransposed:
Validation on macOS / Python 3.14 with Pillow built from this checkout:
python3 selftest.py: 59 passed.This PR was prepared with OpenAI Codex assistance. It does not add an XML parser or a new runtime dependency, and EXIF orientation precedence is unchanged.