Skip to content

Apply EXIF orientation when converting images with ImageMagick#577

Open
casi-3 wants to merge 1 commit into
C4illin:mainfrom
casi-3:fix-exif-auto-orient
Open

Apply EXIF orientation when converting images with ImageMagick#577
casi-3 wants to merge 1 commit into
C4illin:mainfrom
casi-3:fix-exif-auto-orient

Conversation

@casi-3

@casi-3 casi-3 commented Jul 21, 2026

Copy link
Copy Markdown

Photos taken on phones (iPhone DNG/JPEG, Android, most cameras) store pixels unrotated with an EXIF Orientation tag. When converting to formats where that tag is lost or ignored (png, webp, ...), the output comes out sideways.

This adds -auto-orient to the magick invocation so pixels are physically rotated according to the tag before writing the output.

Verified with exif-orientation-examples: Landscape_6.jpg (1200x1800 stored, orientation=RightTop) now converts to an upright 1800x1200 png instead of a sideways one. Added a unit test.


Summary by cubic

Fixes sideways exports by applying EXIF Orientation during conversion. Adds ImageMagick auto-orientation so phone photos output upright in PNG/WebP and other formats that ignore EXIF.

  • Bug Fixes
    • Add -auto-orient to the magick command to rotate pixels before writing output.
    • Add a unit test to verify -auto-orient is passed during JPG→PNG conversion.

Written for commit 0b9c58c. Summary will update on new commits.

Review in cubic

Photos taken on phones store pixels unrotated with an EXIF Orientation
tag. Converting them to formats where the tag is lost or ignored (png,
webp, ...) produced sideways images. Add -auto-orient so the pixels are
rotated according to the tag before writing the output.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

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