Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rational numbers can show sign in denominator rather than numerator (e.g. "1/-2" vs "-1/2") #638

Open
ColibriP2 opened this issue Nov 25, 2023 · 4 comments

Comments

@ColibriP2
Copy link

I noticed in JAlbum which uses Metadata-extractor that Exposure Bias Value is displayed 1/-3 EV instead of -1/3 EV.
The -2/3 value is well handled. I have attached a jpeg showing the problem.
PAPO8138

@jefftucker1952
Copy link

I can add that Windows File Explorer Properties displays it as -0.3 step, as expected. If I take ColibriP2's image and "change" the value in something like EXIF Pilot, just re-entering the same value, metadata-extractor no longer chokes on it, and shows -0.3 EV. Not sure what's buried in the original that's throwing it for a loop.

@drewnoakes
Copy link
Owner

Exif stores rational numbers as two signed integers. In your original image, the denominator must be negative.

We could have the Rational toString method normalise the signs.

@drewnoakes
Copy link
Owner

@drewnoakes
Copy link
Owner

drewnoakes commented Nov 27, 2023

Note that in general, a nicer presentation of Rational values can be obtained via Rational.toSimpleString. That's not the default, however, as it can lose some information relative to toString, and it has a longer running time (https://en.wikipedia.org/wiki/Euclidean_algorithm).

In the original issue, JAlbum could sniff for instances of Rational values and call toSimpleString, which will handle the above case and others (such as converting 0/100 to 0, 7/21 to 1/3, and 1/5 to 0.2 etc.).

@drewnoakes drewnoakes changed the title Wrong display of Exposure Bias Value Rational numbers can show sign in denominator rather than numerator (e.g. "1/-2" vs "-1/2") Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants