Subtracting values from tags

Started by aazimmy12, June 22, 2022, 01:16:21 PM

Previous topic - Next topic

aazimmy12

Hi! I am currently having a problem subtracting a value from my tag on my photos. I used the line -exiftool -degree+=-10 and it says "Warning: Can't shift degree (not a number) - photo.JPG" even though the degree tag has a value of 2.342. I am not sure what I am doing wrong and would really appreciate some help!

StarGeek

What is the exact tag name and group?  Use the command in FAQ #3 to see.

Looking through the tag names pages, I don't see any tag called simply "Degree".  So the name is either something else or it's a tag exiftool can't write.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

aazimmy12

I figured out the problem was that there a bunch of extra spaces before the actual value of the tag like this Degree:            1.234 , and when I set the value of the tag to 1.234 of the tag the subtraction works. However, I need to do this for over 1,000 photos so is there any way to remove the spaces before the value of my tag when they all the degree tags have different values?

Phil Harvey

You can remove all of the spaces from a writable TAG for all writable files in directory DIR like this:

exiftool -tagsfromfile @ -TAG -api filter="tr/ //d" DIR

- Phil

Edit:  Please don't double post.  StarGeek had already answered your question here.
...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 ($).