[Originally posted by b3nj1 on 2009-02-10 21:51:24-08]I'm switching RAW processing applications from Canon Digital Photo Professional (DPP) to Adobe Lightroom 2.x. I'd like to preserve as much as I can from DPP, and I've found mappings and manually created .XMP files for the attributes that I use most (Crop, White Balance, Exposure). Lightroom, interprets my .XMP files as I wish, so I'd like to automate a wholesale move.
I can't figure out how to get exiftool command line to evaluate an arithmetic expression. For example, the crop info in XMP is represented as a ratio and in DPP it's a pixel count. I've tried a few variations of the following, but can't make it work. If I assign the expression to a text field (-Title), the values are substituted in place (which I imagine implies an evaluation of the command-line supplied string).
Is there some syntax sugar I can sprinkle in there to fix it, or do I have to write this in perl. Which I can, but would much rather not :-)
exiftool -o IMG_0220.xmp '-HasCrop<CropActive' '-CropLeft<eval($CropLeft/$ExifImageWidth)' '-CropRight<(($CropLeft+$CropWidth)/$ExifImageWidth)' ./IMG_0220.CR2
Thanks,
Benjamin
[Originally posted by exiftool on 2009-02-10 22:21:37-08]Hi Benjamin,
ExifTool only "interpolates" varariables in string values.
You can't do arithmetic like this.
To do arithmetic, you must create a user-defined tag, then do
the arithmetic in the ValueConv expression (using standard Perl
syntax). You can then copy these user-defined tags to the XMP.
See the
config
file documentation for examples and help.
Let me know if you have any troubles. The config file may seem a
bit tricky at first, but it will do what you want fairly easily.
- Phil