ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: sfmurph on July 25, 2014, 02:53:47 PM

Title: "Foolproofing" MaxApertureValue
Post by: sfmurph on July 25, 2014, 02:53:47 PM
So I recently realized that I got burned by how MaxApertureValue is defined, set and printed. I had assumed that it took f-stop, but it really is APEX value. To protect well-meaning lunkheads like me, it would be nice to have a warning when setting this to common f-stop values (1.4, 2.8, etc). Perhaps allow for -MaxApertureValue= to accept strings like f/1.4 or f/2 to have these set as expected? A second part would be in printing to add the units, so instead of printing "Max Aperture Value : 1.4", print "Max Aperture Value : 1.4 Ev (f/1.65)". This would have indicated to me that something was not as I expected. (Similar things could be done for ShutterSpeed value, etc.)

Anyway, it seems that other software also presents this data in different ways, which only adds to the confusion!
Title: Re: "Foolproofing" MaxApertureValue
Post by: Phil Harvey on July 26, 2014, 06:27:26 AM
The ExifTool EXIF Tag Name documentation (https://exiftool.org/TagNames/EXIF.html) says this about MaxApertureValue: (displayed as an F number, but stored as an APEX value)

So you aren't a lunkhead.  These values are converted to equivalent F-number by ExifTool, and written in the same way.

- Phil
Title: Re: "Foolproofing" MaxApertureValue
Post by: sfmurph on July 26, 2014, 02:11:38 PM
What makes it hard is that, while it's in the documentation, it's not clear in the output. Outputting as "f/2.0" instead of just 2.0 would make it clear what units are being used. Also, using the -n or -MaxApertureValue# form doesn't disable this conversion -- exiftool still prints the converted to equivalent f-number and not the unconverted APEX value.

It doesn't help that the APEX values and f-numbers are so close (f/2.0 = 2 Av & f/4.0 = 4, plus f/1.8 = 1.7 Av and f/3.5 = 3.6 Av, etc). It was easy for me to get confused. It also doesn't help that the camera and software makers seem to get these confused as well.
Title: Re: "Foolproofing" MaxApertureValue
Post by: Phil Harvey on July 26, 2014, 08:21:09 PM
Quote from: sfmurph on July 26, 2014, 02:11:38 PM
What makes it hard is that, while it's in the documentation, it's not clear in the output. Outputting as "f/2.0" instead of just 2.0 would make it clear what units are being used.

I see.  But I can't change this now or I break more than 10 years of backward compatibility (plus, I don't recall anyone ever suggesting this before).

QuoteAlso, using the -n or -MaxApertureValue# form doesn't disable this conversion -- exiftool still prints the converted to equivalent f-number and not the unconverted APEX value.

Correct.  This just disables the rounding to 1 decimal point.

QuoteIt doesn't help that the APEX values and f-numbers are so close (f/2.0 = 2 Av & f/4.0 = 4, plus f/1.8 = 1.7 Av and f/3.5 = 3.6 Av, etc). It was easy for me to get confused. It also doesn't help that the camera and software makers seem to get these confused as well.

I agree.  If this were 10 years ago, I would probably implement your suggestion.

- Phil
Title: Re: "Foolproofing" MaxApertureValue
Post by: sfmurph on July 27, 2014, 04:40:34 PM
Ah yes, backwards compatibility can be tough to maintain!

What burned me is the read-write round trip. Do this to see what the MaxApertureValue is:

$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue
Max Aperture Value              : 1.4
And the un-rounded version
$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue#
Max Aperture Value              : 1.4142135623731

But then setting with that value actually sets it to something else (but close)
$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue=1.4
then
$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue#
Max Aperture Value              : 1.40000000201821

The problem is that the rounded value is what the APEX value is calculated from, so instead of having stored "1", it's 0.9708536585 (7961/8200).

The workaround is to use precise, mathematical f-numbers and not the convenient stings 1.4, 2.8, etc.
Title: Re: "Foolproofing" MaxApertureValue
Post by: Phil Harvey on July 28, 2014, 07:38:49 AM
Quote from: sfmurph on July 27, 2014, 04:40:34 PM
But then setting with that value actually sets it to something else (but close)
$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue=1.4
then
$ exiftool -overwrite_original_in_place file.JPG -MaxApertureValue#
Max Aperture Value              : 1.40000000201821

The problem is that the rounded value is what the APEX value is calculated from, so instead of having stored "1", it's 0.9708536585 (7961/8200).

This rounding phenomenon is discussed in FAQ number 4 (https://exiftool.org/faq.html#Q4).  To get an APEX value of 1, you must set the MaxApertureValue f-number to the square root of 2, not to 1.4:

> exiftool a.jpg -maxaperturevalue=1.414213562373095
    1 image files updated
> exiftool a.jpg -maxaperturevalue#
Max Aperture Value              : 1.4142135623731
> exiftool a.jpg -v | grep Max
  | | 3)  MaxApertureValue = 1 (1/1)


The last command with the -v option shows the APEX value that was stored in the file.

- Phil