Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation info from HEIC decoder does not match actual pixel orientation #1232

Closed
rudchenkos opened this issue Jul 31, 2018 · 0 comments
Closed

Comments

@rudchenkos
Copy link
Contributor

Description

It turns out that in HEIC the pixels are never rotated and the metadata only indicates the orientation of the sensor when the photo was taken. After ReadHEICImage populates EXIF profile and returns a decoded image, the exif:Orientation property is interpreted by ReadImage which sets Image->orientation accordingly.

Hence, there is a discrepancy between Image->orientation and actual pixel orientation in images loaded with the heic coder. Particularly, this leads to incorrect behavior of the -auto-orient which in this case tries to compensate non-existing pixel rotation.

Steps to Reproduce

  1. Take a HEIC image with exif:Orientation not equal to "1" (TopLeftOrientation). For instance, a portrait photo with one of the newer Apple iPhone devices. You can download an example photo here: https://www.dropbox.com/s/celi7ejhit9ybzb/test.heic?dl=0
  2. Desktop image viewers like Preview on macOS normally display the photo as if camera was not rotated.
  3. convert test.heic -auto-orient test.jpg

Expected result

test.jpg appears in viewers the same way as original.

Actual result

test.jpg appears sideways.

System Configuration

  • ImageMagick version: 7.0.8-9 Q16
  • Environment: macOS 10.13.6, but the problem is cross-platform
rudchenkos added a commit to rudchenkos/ImageMagick that referenced this issue Jul 31, 2018
It turns out that in HEIC the pixels are never rotated and the metadata only
indicates the orientation of the sensor when the photo was taken.

Hence, there was a discrepancy between `Image->orientation` and actual pixel
orientation in images loaded with the `heic` coder. Particularly, this led to
incorrect behavior of the `-auto-orient` which in this case tried to compensate
non-existing pixel rotation.

ImageMagick#1232
dlemstra pushed a commit that referenced this issue Sep 3, 2018
* Align pixel orientation with exif:Orientation in HEIC decoder

It turns out that in HEIC the pixels are never rotated and the metadata only
indicates the orientation of the sensor when the photo was taken.

Hence, there was a discrepancy between `Image->orientation` and actual pixel
orientation in images loaded with the `heic` coder. Particularly, this led to
incorrect behavior of the `-auto-orient` which in this case tried to compensate
non-existing pixel rotation.

#1232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants