Thread

Posted on Fri May 25 10:42:53 2007 by cocker68
How to multiply an EXIF-value?

Hello,

how would I divide or multiply an EXIF-value?

I got some files in which for whatever reason the value for FocalLength is ten times its real value, and I would like to correct this with exiftool

The following failed:

exiftool '-FocalLength=FocalLength*0.1' image.jpeg Not a floating point number for ExifIFD:FocalLength Argument "FocalLength*0.1" isn't numeric in multiplication (*) at (eval 30) line 8, <EXIFTOOL_FILE2 +> chunk 10. 1 image files updated exiftool '-FocalLength=FocalLength/10' image.jpeg Not a floating point number for ExifIFD:FocalLength Argument "FocalLength/10" isn't numeric in multiplication (*) at (eval 30) line 8, <EXIFTOOL_FILE2> + chunk 10. 1 image files updated

- Cocker :wq

Direct Responses: 5228 | Write a response
Posted on Fri May 25 14:40:58 2007 by exiftool in response to 5227
Re: How to multiply an EXIF-value?
Hi Cocker,

Is this a makernote value which is wrong? It sounds to me like this could be a problem with the way ExifTool is interpreting the value. If so, this should be fixed. What is the camera model? Can you send me a sample image?

Currently there is no way to perform math on extracted values via the command line interface.

- Phil
Direct Responses: 5229 | Write a response
Posted on Fri May 25 19:00:38 2007 by cocker68 in response to 5228
Re: How to multiply an EXIF-value?

OK - the base of my problem was a fata morgana.
Exiftool does interpret every value of this Pentax-K10D-image correctly:

exiftool Pentax_K10D.jpeg | grep Focal Focal Length : 100.0mm Focal Length In 35mm Format : 150 Focal Length : 100.0mm (35mm equivalent: 150.0mm)

Only the EXIF-module of this Forum shows for whatever reason ten times the value.

But not to appear as a dumbass here, for anyone interested I show a solution in Bash.

F="Pentax_K10D.jpeg"; FL=$(exiftool -FocalLength "$F" | sed -e 's/[^0-9]*\([0-9]*\).*/\1/'); exifto +ol -FocalLength="$((FL/10))" "$F"

This divides the value of FocalLength by 10.

Maybe there is a more elegant solution for that.

- Cocker :wq

Direct Responses: 5230 | Write a response
Posted on Fri May 25 19:21:25 2007 by exiftool in response to 5229
Re: How to multiply an EXIF-value?
Ah, the K10D. I'm thinking about buying one of these. Nice camera. I've had my hands on one and done a fair bit of meta information analysis on these images, so this camera is fairly well supported by ExifTool. There are constants that need to be applied to the maker notes FocalLength values, and sometimes these constants change from model to model, so I could see them being wrong for some models, but I wouldn't expect a problem like this for a well-tested model like the K10D.

So it's good to hear that it isn't a problem with ExifTool.

Cool command, btw. Interesting use of sed. But personally I would tend to use exiftool features rather than sed to accomplish as much as possible:

F="Pentax_K10D.jpeg"; FL=$(exiftool -FocalLength "$F" -s -S -n); exiftool -FocalLength="$((FL/10))" + "$F"

- Phil
Direct Responses: 5234 | Write a response
Posted on Sat May 26 12:34:48 2007 by cocker68 in response to 5230
Re: How to multiply an EXIF-value?

*eeh* I knew, there would be an exiftool'ish way... :-)

Thanks
- Cocker :wq

Write a response