Support EXR Chromaticities data type

Started by Elliott B, November 25, 2019, 01:46:55 PM

Previous topic - Next topic

Elliott B

OpenEXR can contain a variety of data types including float, int, string, and also "chromaticities" which is an array of 8 floats.  Exiftool 11.75 distorts the values of this type.  I'd like to request displaying these numbers accurately and as some sort of list data type.

exrheader shows it correctly:

CC (type chromaticities):
    red   (0.7347 0.2653)
    green (0 1)
    blue  (0.0001 -0.077)
    white (0.32168 0.33767)

Exiftool shows different values:
<OpenEXR:CC>0.73470002412796 0.265300005674362 0 1 9.99999974737875e-05 -0.0769999995827675 0.321680009365082 0.337669998407364</OpenEXR:CC>

Sample image:
https://mega.nz/#!18QmmaST!sZRFbhcw-5tAI0dhdWVOC9ESjsBwkw57KG11pvT1npY

Phil Harvey

Distorts?

It looks to me as if exrheader is rounding the result to 5 or 6 significant figures.  ExifTool is returning the actual stored value without rounding.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Elliott B

I created this file using only 5 decimal places in each value in another application.

Phil Harvey

Yes, but the 32-bit floating-point representation is not exact.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on November 25, 2019, 02:09:27 PM
Yes, but the 32-bit floating-point representation is not exact.

This is what I recall from my Comp Science classes many years ago.  While this article is centered on Python, it applies to any floating point numbers.

If you type your original numbers into this floating point converter, you'll see that it results in the numbers that exiftool reports.

Edit: Additional StackOverflow answer
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Elliott B

Ok thanks, I understand now.  Wow, this is an unfortunate limitation of decimal to binary conversion, making it impossible to get the exact value entered in the first place.  I guess the only way around this would be to use some kind of character encoding instead of treating the numbers as floats?

Phil Harvey

@StarGeek:  Cool floating point converter.  Thanks for the link and the additional info.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).