Closed kiyeon-jo closed 4 years ago
Sample image with two orientation
uploaded photo exif.get('Software') => "Microsoft Windows Photo Viewer 6.1.7600.16385"
Usually read the last 'orientation' value when inserting an image into the browser.
Thanks for the report @kiyeon-jo.
I can confirm that your sample image does indeed contain two Orientation values.
Curious, I'm not aware of the EXIF standard supporting two values for the same tag number in the same Image File Directory.
exiftool, which I consider as the standard tooling for EXIF, also only reports the last Orientation value when used on your sample image:
exiftool -Orientation image.jpg
Orientation : Horizontal (normal)
Technically it would be possible to collect all values for the same tag, but it's not clear how this data should be returned and consuming code would be surprised if the return value has a different type (e.g. an Array of two values instead of a single value).
Since the last Orientation value is also the correct one, I'm assuming that is expected behavior, so I'm inclined to close this ticket.
Hi @blueimp ,
You are right, the problem I encounter seems to be a case of duplicate orientation values.
When I use the function here , I get the orientation that is right in my case. Would it be a good idea to use this code in your library in order to solve such case ?
Here the result from exiftool :
And last thing, I think the problem occurs for the same reason as for kiyeon-jo : Software : Microsoft Windows Photo Viewer 6.1.7600.16385
Thanks again for your report @flexilivre. I'm now thinking that it might be valid to store a second Orientation value for the Thumbnail data. I'll look into this and will likely release an update.
I learned now that the Thumbnail directory (IFD1) can contain all Exif tags that appear in the main image meta data directory (IFD0), so storing them in the same map created override issues.
I've released a new version that stores the IFD1 (Thumbnail) data in a separate ExifMap: https://github.com/blueimp/JavaScript-Load-Image/blob/master/README.md#exif-thumbnail
Thanks to this change, the thumbnail Orientation will not override the original image Orientation anymore and should fix the issues both of you encountered.
Here's how to retrieve both Orientation values:
exif.get('Orientation')
exif.get('Thumbnail').get('Orientation')
Thanks again for your help @kiyeon-jo and @flexilivre!
Thank you always.
Your library reads only one orientation.
Of course, it is normal to have only one.
Unfortunately, if you rotate in the Microsoft Windows Photo Viewer, you will have two orientation records.
Can't you provide two pieces of information?
For your information, http://exif.regex.info/exif.cgi is showing two orientation information here.