Skip to content

[6.x] Swap image dimensions when EXIF orientation indicates a 90° rotation#14685

Merged
jasonvarga merged 2 commits into
6.xfrom
image-rotation
May 18, 2026
Merged

[6.x] Swap image dimensions when EXIF orientation indicates a 90° rotation#14685
jasonvarga merged 2 commits into
6.xfrom
image-rotation

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

getimagesize() returns raw file dimensions without accounting for EXIF orientation. For photos taken in portrait mode on phones (e.g. iPhone), the pixel data is stored in landscape orientation with an EXIF orientation tag (typically 5–8) indicating the image should be rotated 90° when displayed. This caused reported dimensions and aspect ratios to be wrong.

Orientations 5–8 all involve a 90° rotation, so we now swap width and height for those cases — the same logic already applied to rotated videos.

Fixes #14681

🤖 Generated with Claude Code

jasonvarga and others added 2 commits May 18, 2026 09:51
Orientations 5–8 all involve a 90° rotation, so the stored pixel dimensions
are transposed relative to how the image is actually displayed. Mirrors the
existing behaviour for rotated videos.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit 431c8ad into 6.x May 18, 2026
17 checks passed
@jasonvarga jasonvarga deleted the image-rotation branch May 18, 2026 20:01
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.

Asset dimensions doesn't respect exif rotation

1 participant