Project

General

Profile

Bug #935

Different values for some metadata with exiftool

Added by Jehan Pagès about 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
exif
Target version:
Start date:
07 Nov 2013
Due date:
% Done:

100%

Estimated time:

Description

Hi,

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?
Thanks.


Files

IMG_4810.JPG (5.92 MB) IMG_4810.JPG Jehan Pagès, 07 Nov 2013 22:48
bug935.diff (802 Bytes) bug935.diff Jehan Pagès, 22 Aug 2015 10:20

Associated revisions

Revision 3893 (diff)
Added by Andreas Huggel about 6 years ago

#935: Fixed ExposureTime pretty-print function.

Revision 3894 (diff)
Added by Andreas Huggel about 6 years ago

#935: Added a test-case and updated existing tests for the improved ExposureTime pretty-print function.

History

#1

Updated by Niels Kristian Bech Jensen almost 8 years ago

  • Category set to metadata
  • Status changed from New to Assigned
  • Assignee set to Niels Kristian Bech Jensen
#2

Updated by Alan Pater over 6 years ago

As far as the different labels go, exiftool is giving you it's own Composite tags:

http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Composite.html

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?

#3

Updated by Niels Kristian Bech Jensen over 6 years ago

  • Assignee deleted (Niels Kristian Bech Jensen)
#4

Updated by Robin Mills about 6 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 about 6 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. :-)
Thanks!

For reference, the GIMP bug hanging: https://bugzilla.gnome.org/show_bug.cgi?id=711242

#6

Updated by Jehan Pagès about 6 years ago

Hi again,

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 about 6 years ago

  • Status changed from Closed to Feedback
  • Assignee changed from Robin Mills to Andreas Huggel

Jehan:
I will not enter into a lengthy discussion about this. I have reopened the issue and assigned it to Andreas for Feedback.

Andreas:
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 about 6 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
#9

Updated by Jehan Pagès about 6 years ago

Awesome, thanks!

#10

Updated by Andreas Huggel about 6 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.

#11

Updated by Robin Mills about 6 years ago

  • Status changed from Resolved to Closed

I'm going to set the status of this to closed. It has been 100% resolved for some time without further incident.

#12

Updated by Robin Mills over 4 years ago

  • Subject changed from Different values for some metadata with exiftool to Different values for some metadata with exiftool

Also available in: Atom PDF