Config file newbie question

Started by Mike Lee, March 06, 2012, 10:32:24 AM

Previous topic - Next topic

Mike Lee

I'll apologize right up front, I'm having a difficult time with the config file syntax.  I'm wanting a "simple" config file to convert the ten millionths decimal precision of the GPSImgDirection tag to no decimal places.  I've studied the sample user configuration file http://www.exiftool.org/config.html but can't quite find an example which suits my needs.  I know I need to convert the hard coded precision of that tag by way of a composite value which reflects no decimal places, and to accomplish that I need a config file.  This is all I'm capable of at the moment:

%Image::ExifTool::UserDefined = (
   'Image::ExifTool::Composite' => {
       GPSImgDirection => {
           Require => 'EXIF:GPSImgDirection',
           PrintConv => '$val = ??? ; $val',
       },
   },
);
1; # end

Am I even close, or heading in the right direction?  I don't know how to specify the new precision (value).  These "zillion" decimal places are a real pain :) (Phil)

Many thanks for any and all direction in this!

Mike

Phil Harvey

Hi Mike,

You're very close.  Try this:

%Image::ExifTool::UserDefined = (
   'Image::ExifTool::Composite' => {
       GPSImgDirection => {
           Require => 'EXIF:GPSImgDirection',
           PrintConv => 'sprintf("%.1f",$val)',
       },
   },
);
1; # end


The ".1" specifies the number of digits after the decimal point.  Change this to whatever you want.

Maybe I should do something like this in the production version of exiftool.

- 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 ($).

Phil Harvey

Quote from: Phil Harvey on March 06, 2012, 10:47:11 AM
Maybe I should do something like this in the production version of exiftool.

I just checked, and ExifTool is not currently limiting the precision for any of the following GPS tags:

GPSAltitude, GPSDOP, GPSSpeed, GPSTrack, GPSImgDirection, GPSDestBearing, GPSDestDistance and GPSHPositioningError.

Until you, I don't remember anyone complaining about too much precision in any of these numbers.  But if I get some complaints it may be worthwhile to add a conversion for all of these.

- 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 ($).

Mike Lee

Phil,

You are, as always, most helpful and accommodating.  Thank you very much. 

I mentioned "zillion" in academic jest, referring to a remark you made in the forums last July, "Also, nobody wants to see a zillion decimal places in their FNumber, so ExifTool rounds to 1 decimal for the print conversion."

Yes, I would submit that there are probably some tags for which precision needs to be controlled or managed.  Some (many?) instruments record measurements beyond their actually capabilities, and it is those measurements that need their precision reduced.  The ones you mentioned would probably be among those tags that could benefit from conversion.

Indebted,

Mike