Math add two fields

Started by sylloge2, May 04, 2020, 12:45:39 AM

Previous topic - Next topic

sylloge2

-n -tagsFromFile @ -RelativeAltitude+=2
-n -tagsFromFile @ -AbsoluteAltitude+=2

both add 2m to the field

what is the syntax to add them together

-n -tagsFromFile @ -AbsoluteAltitude+=-RelativeAltitude
gives
Warning: Shift value for XMP-drone-dji:AbsoluteAltitude is not a number

I won't go into the dozen alternative attempts that didn't work!@#

Thanks

StarGeek

Try
exiftool -TagsFromFile @ "-AbsoluteAltitude<${AbsoluteAltitude;$_-=$self->GetValue('RelativeAltitude')}" /path/to/files/

Example
C:\>exiftool -g1 -a -s -*Altitude y:\!temp\Test4.jpg
---- XMP-drone-dji ----
AbsoluteAltitude                : 30
RelativeAltitude                : 20

C:\>exiftool -P -overwrite_original -TagsFromFile @ "-AbsoluteAltitude<${AbsoluteAltitude;$_-=$self->GetValue('RelativeAltitude')}" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -*Altitude y:\!temp\Test4.jpg
---- XMP-drone-dji ----
AbsoluteAltitude                : 10
RelativeAltitude                : 20


The name of the tag in the GetValue function is case sensitive and must be the exact name.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

sylloge2