How to multiply an EXIF-value?

Started by Archive, May 12, 2010, 08:54:05 AM

Previous topic - Next topic

Archive

[Originally posted by cocker68 on 2007-05-25 07:42:53-07]

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:

Code:
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

Archive

[Originally posted by exiftool on 2007-05-25 11:40:58-07]

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

Archive

[Originally posted by cocker68 on 2007-05-25 16:00:38-07]

OK - the base of my problem was a fata morgana.

Exiftool does interpret every value of this Pentax-K10D-image correctly:

Code:
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.

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

This divides the value of FocalLength by 10.

Maybe there is a more elegant solution for that.

- Cocker :wq

Archive

[Originally posted by exiftool on 2007-05-25 16:21:25-07]

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:

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

- Phil

Archive

[Originally posted by cocker68 on 2007-05-26 09:34:48-07]

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

Thanks

- Cocker :wq