Exif value - normalize fractions

Hi all,

I am using the current stable version of kirby and have some issues with the exif functions. This blog post (https://blog.hofherr.me/blog/Sauwohl) shows weird values for focal length (is: 2300/100, should be: 23) and for exposure (is: 10/220000, should be: 1/22000). Do I have to normalize the output of $exif->exposure() and $exif->focalLength() myself or is there something I am missing?

Thanks and best regards,

Matthias

These values come straight from the PHP function read_exif_data. I don’t have much experience with Exif, but I guess these are also the values saved in the Exif header of the image. You might need to normalize them yourself.

If that is the case, it would make sense to normalize these values in the methods.

Every camera manufacturer has its own definition of the Exif standard, so I think automagically modifying the data is very difficult to do right.

Thanks for the clarifications. I will do the normalization myself. Based on a short look at the exifs of different photos from Nikon, Canon, Fujifilm and Sony, I guess a central normalization should be possible.

Br,
Matthias

What we could do is to change the two values to floats. The user could then change them back to fractions depending on the requirements and wanted normalization.
What do you think?

Usually, the f-number is given as a float, but the shutter speed as a fraction, so you would still have to normalize the values.

True! Actually the exposure time is basically always given as 1/x, so that normalization is not that difficult and can be generalized in the Exif class.

Re. exposure: This is only true for exposure below 1 sec. Long time exposure is usually listed in seconds.

Yeah, absolutely correct. :wink:

Oh, absolutely, you are so right.