Hi there
For exposure bracketed sequences I'm using exiftool to embed the ExposureCompensation tag in the filename. With the '<' syntax like:
$ exiftool '-FileName<%f_EV${ExposureCompensation;}.%e' .
this is blazingly fast! Very cool!
However I have some strange ExposureCompensation values like "+0.996" and "-0.996". They are cearly meant to be +1 and -1. (The image file provider -- CameraPixels app on iOS -- seems to do something wrong here).
To cut a long story short, in the renamed filename I would like to round the ExposureCompensation values to 2 significant digits, so that 0.996 becomes 1. Is this possible with the '<' syntax?
Many thanks for any pointers!
There are a number of ways to round values. One way is to use sprintf. To get 2 significant digits with a sign, you would use %+.2g, like this:
exiftool '-FileName<%f_EV${ExposureCompensation#;$_=sprintf("%+.2g",$_)}.%e' .
Here I have added a "#" to start from the numerical value (eg. 0.66666) instead of the converted value (eg. +2/3) since most ExposureCompensation tags are returned as fractions.
- Phil
Work brilliantly, Phil.
Thanks a lot for spelling out the details.
I really appreciate it.
Leo