-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Wrong image auto orientation ? #7306
Comments
What command did you use? Did you include -auto-orient? See https://imagemagick.org/script/command-line-options.php#auto-orient |
Hi @fmw42, It is a C binding which calls these functions in this order: MagickBooleanType MagickReadImage(MagickWand *wand, const char *filename) |
Did you check if this still reproduces in the latest version of ImageMagick? There might also be other metadata that results in a different orientation. But without an image we probably cannot give you more information. |
HI @dlemstra, Here you can find two images. The first one is oriented correctly but the second one does not: It looks like that the EXIF informations is incorrect but I do not think that Apple will do such thing. |
May be I am facing the same issue as #5183 ? |
pwhc7j1vpy7h.zip.001.zip Adding images for future reference. |
Your tiff file contains a
So I suspect that the software that created this has written |
Hi @dlemstra, |
There is no need to mention my name in the response. The TIFF value of |
Hmm, I am a bit confused :( |
See https://irfanview-forum.de/forum/program/feature-requests/1943-https://helpx.adobe.com/content/dam/help/en/photoshop/pdf/DNG_Spec_1_7_1_0.pdf I cannot seem to download and/or unzip your files. So my question is do the exif orientation and the tiff orientation flags indicate the same needed orientation rotation? |
Please, take a look of this: python-pillow/Pillow#4053 |
That looks like a Pillow issue, not a tiff tag issue. |
Please repost an image with this issue. When I download your file, it has no suffix. When I try the zip file, it won't unzip. It says "unsupported format" Nevermind, I see that your file is tiff. So I added a tiff suffix to it. |
Yes, it is a Pillow issue but look how they handle the tiff orientation tag values: if orientation == 2: |
When I look at your bad example in Imagemagick display, it looks like it has been photographed so that it needs to be rotated 90 to the left or counter clockwise. That is it is photographed 90 clockwise from a proper orientation. From the verbose information and from exiftool, it shows: IM verbose info Orientation: RightTop Exiftool: 274 Orientation : Rotate 90 CW I think the exiftool means that the image was rotated 90 CW. So both of these mean that it needs to be rotated 90 CCW, which is what IM has done. I think that the OP may be using a viewer that does not respect the orientation tag and so the result looks wrong.. He should try using magick display to view the original and then the -auto-oriented image and see if that looks correct
|
So what about the Pillow tags. Perhaps they mean what you need to do with the file to correct, not what is wrong with the file. Is that just a difference in cw vs ccw. That is ROTATE_270 CCW is the same as ROTATE_90 CW. |
Please, find an iPhone and take some pictures in RAW format (RAW in the top right corner of the camera app). |
Why don't you try taking a picture and save it some other format and see if you get the same issue and let us know. You never answered what viewer you are using to view your results. Did you view in some other app or with
or
to ensure it is reading as DNG. |
I found this diagrammatic interpretation. https://sirv.com/help/articles/rotate-photos-to-be-upright/ Also see the section titled: Incorrect EXIF orientation |
FYI Original images: Auto rotated by Pillow: And the python script: Best regards |
I cannot get to your images. A login username and password is needed. Nevertheless, what is the point here? We are not a Pillow or Python forum. |
Links should work again. The point here is that there could be an explanation other than wrong exif information. |
I looked at your JPG example. It shows Imagemagick: Orientation: RightTop Exiftool: 274 Orientation : Rotate(d) 90 CW Both indicate to rotate the image CCW 90 deg, which is what Imagemagick is doing if you use the magick display to view it. I have no idea what other software is doing? The image looks correct to you an me on Mac Preview because many other tools are ignoring the orientation tag. I have no idea why the image is tagged with RightTop meaning to re-orient by 90 deg CCW. |
If exif is ignored (stripped), the original jpeg image is rotated at 90 CCW and the original TIFF image is rotated at 90 CW. |
What viewer did you use to examine the images? When I strip the meta data for your JPG image and view the results in Imagemagick, the RightTop corner of the image is in the LeftTop position. So it has been rotated 90 CCW and needs to be rotated 90 CW. I might have referenced that backwards before. Nevertheless, Imagemagick is auto-orienting the image properly when viewed with Imagemagick display. And the original is viewed by Imagemagick with its RightTop corner in the LeftTop position indicating it needs rotating 90 CW |
I use Safari and Chrome but always strip the exif data. |
See my edited comment above. Mac Preview seems to auto-orient automatically, because both the input and the auto-oriented versions (not stripped) are viewed with it correctly. Some viewers do that automatically, such as Mac Preview and on my Safari. |
Yes, for jpeg ImageMagick produces correct results but not for tiff. |
It works properly unstripped for me in Safari because Safari does the auto-orient automatically when viewing. So I do not understand how you view it correctly after stripping unless ... Might you be stripping after it has been corrected by these tools automatically? |
I strip the exif of original images only to verify their actual orientation. |
As of my understanding the exif orientation tag has different meanings for jpeg and tiff formats:
|
After auto-orient, there is no need to strip. As for differences between tiff and jpg, if the both use the exif standard, then they would be the same. I cannot believe that they would not be following the standard. |
If you see a difference in the text representation, then that is either because one is say how the image is mis-rotated and the other is saying how it should be rotated to correct it. Those would be just the opposite directions. |
I am still trying to find some trustful information about such a difference but you see how Apple and some other imaging softwares are handling tiff orientation. |
Both files (your JPG and your TIFF) are displayed properly when you preface your tiff with dng: or change the suffix to .dng. It show up wrong when I display without the preface. Is that TIFF really DNG? magick display pwhc7j1vpy7h_orig.tiff shows with LeftBottom at 0,0 (so would need 90 CCW to correct) and displays wrong (upside down) after correction because the exif orientation say RightTop magick display dng:pwhc7j1vpy7h_orig.tiff. show with RightTop at 0,0 (so would need 90 CW to correct) and is corrected as the exif orientation says RightTop. Sorry, I do not know why the behave opposite. I know that DNG follows the TIFF format. But there must be some coding differences that control this difference according to whether Imagemagick knows it is actually DNG or TIFF from the suffix (or DNG: preface). That is a question for one of the Imagemagick developers or user who know more about DNG vs TIFF than I do. |
The file suffix does not matter and should not be used to determine the file type. See the output below: file pwhc7j1vpy7hpwhc7j1vpy7h: TIFF image data, big-endian, direntries=32, height=0, bps=0, compression=JPEG, PhotometricInterpretation=YCbCr, manufacturer=Apple, model=iPhone 12 Pro, orientation=upper-right, width=0 exiftool pwhc7j1vpy7h
|
It looks like this file is a raw file pretending to be a tiff. I just pushed a patch that will detect from the header of the image that it is a raw file:
This will become available in the next release. |
Actually, the file pwhc7j1vpy7h was something with .dng extension and the exiftool reports it as a DNG file type. |
Did you read my comments above showing that the tiff file was miss-labeled and was really dng. When using as dng, it auto-oriented fine. |
How to tell to this function something related to your explanation?
|
What does this have to do with auto-orient? Are you reading a blob or an image format? Please clarify. |
Please, ask someone of developers to take a look at this issue or close it! |
ImageMagick version
7.1.1-26
Operating system
Other (enter below)
Operating system, version and so on
FreeBSD 14
Description
Wrong image orientation using MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
Steps to Reproduce
Here is the EXIF information. As a result of auto orientation the image is rotated incorrectly at 90 CW but should be rotated at 90 CCW!
Images
No response
The text was updated successfully, but these errors were encountered: