Different values for some metadata with exiftool
|Status:||Closed||Start date:||07 Nov 2013|
|Assignee:||Andreas Huggel||% Done:|
I'm a GIMP dev, and we now use Exiv2 (through the GExiv2 API).
I noticed that a photograph had these metadata, according to exiftool:
Shooting Mode : Bulb
Shutter Speed : 60.5
Exiv2 would return us these (checked with the exiv2 command line):
Exposure time : 61 s
Exposure mode : Manual
Which I think are equivalent. I don't mind the slightly different label naming, but why are the values different?
The user who gave us this photograph said it was indeed shot in bulb mode, so I imagine it makes more sense than "manual".
And why is the exposure time approximated to integer if it is float?
#2 Updated by Alan Pater over 2 years ago
As far as the different labels go, exiftool is giving you it's own Composite tags:
If you give exiv2 the -pv mode, it will give you the plain value of ExposureTime.
$ exiv2 -pv -g ExposureTime IMG_4810.JPG
0x829a Photo ExposureTime Rational 1 605/10
What does gexiv2 get_exposure_time give you?
#4 Updated by Robin Mills over 2 years ago
- Category changed from metadata to not-a-bug
- Status changed from Assigned to Closed
- Assignee set to Robin Mills
- Target version set to 0.26
I don't think there is a case to answer here. As Alan has pointed out, the "vanilla" values are correct.
$ exiv2 -pv -g ExposureMode -g ExposureTime http://dev.exiv2.org/attachments/download/574/IMG_4810.JPG 0x829a Photo ExposureTime Rational 1 605/10 0xa402 Photo ExposureMode Short 1 1 $The "interpreted" values may be different from Exif tool. However "interpreted" means human readable. I'm a little surprised that ExposureTime has been expressed as an integer and not a number. However exiv2 has been presenting data in this form for years and changing it may break a user script.
$ exiv2 -pt -g ExposureMode -g ExposureTime http://dev.exiv2.org/attachments/download/574/IMG_4810.JPG Exif.Photo.ExposureTime Rational 1 61 s Exif.Photo.ExposureMode Short 1 Manual $The current behaviour will be maintained.
#5 Updated by Jehan Pagès over 2 years ago
I'll just make a small case, hoping you will come back on this decision.
However exiv2 has been presenting data in this form for years and changing it may break a user script.
I notice that if you run exiv2 on images with smaller exposure (not sure when the switch happens. After 1 sec maybe?), you get a rational output:
Exposure time : 1/25 s
So that means that any working script existing out there would already know how to handle rational output. So I propose you always stick to rational output (unless maybe the denominator == 1) and no script would ever be broken. :-)
For exposure time, really half a second is the whole world! You just can't say that 0.5 sec and 1 sec are the same thing when it comes to photographic exposure. No photographer would ever accept such a point. Hence I would say this is an obvious bug. So even though it somehow broke some scripts out there (but aren't they already broken if they show a wrong value? Furtheremore as I showed above, I don't even think any script would break anyway since you already sometimes show rational values), it may also fix a lot of workflow involving exiv2. It would fix ours for GIMP at least.
As Alan has pointed out, the "vanilla" values are correct.
We can indeed use gexiv2_metadata_get_exposure_time () and it does work (I tested right now). And we should probably do so for at least all the standard Exif tags at some point. But right now, there are no special handling codes in GIMP. We just display all the tags with gexiv2_metadata_get_tag_interpreted_string(), which gives us indeed a human readable version of values (with unit added, etc.), without any specific handling of any metadata.
Now I see we could try and get the type for every tag with gexiv2_metadata_get_tag_type(), and if it's a rational we get the rational value. But really that gets us uglier output (it's nicer to have a "F5" aperture display, rather than just 5, or units appended like "60.5 s", etc.). So basically the current exiv2 API does not allow us a perfect "generic handling" of metadata (either we lose accuracy or we lose pretty human readable output).
As a conclusion, I really hope you will reopen this report and fix this. :-)
For reference, the GIMP bug hanging: https://bugzilla.gnome.org/show_bug.cgi?id=711242
#6 Updated by Jehan Pagès over 2 years ago
- File bug935.diff added
I had a quick look at your code. As I thought, it's as simple as just removing a few lines.
I also realized that the unaccuracy issue would not only occur for exposure > 1 sec, but also for (t.first > 1 && t.second > 1 && t.second >= t.first). For some reason, your current code would transform a "2/3 s" exposure time in "1/2 s"! This looks like a serious bug to me.
Attached a patch which simply gets rid of all this value changing (hence always displays accurate values!). Tested and working! :-)
#7 Updated by Robin Mills over 2 years ago
- Status changed from Closed to Feedback
- Assignee changed from Robin Mills to Andreas Huggel
I will not enter into a lengthy discussion about this. I have reopened the issue and assigned it to Andreas for Feedback.
If you think we should fix this, please assign it to me and I will review Jehan's patch and fix it.
If you think we should decline this request, please close the bug.
#8 Updated by Andreas Huggel over 2 years ago
- Category changed from not-a-bug to exif
- Status changed from Feedback to Assigned
Jehan you're right: we indeed convert an exposure time of 2/3 s to 1/2 s! The only reason I can think of why this has not come up a very long time ago, is that 2/3 s is not a common exposure time.
I've checked-in a fix for that, which also does away with the rounding. We now write ExposureTime as 1 over something if that's possible or else as a float value. The command line tool now shows 60.5 s for the sample image.
Exposure time : 60.5 s
#10 Updated by Andreas Huggel about 2 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Marking this as resolved after some more investigation: exiftool's 'Shooting Mode' (Bulb) and exiv2's 'Exposure Mode' (Manual) info are not the same. The exiv2 value is taken from tag Exif.Photo.ExposureProgram in this case. In exiftool the value of this tag is also 'Manual'. On the other hand, exiftool's 'Shooting Mode' is a "composed tag" as Alan pointed out and Exiv2 doesn't have anything that corresponds to it.