I looking to make an if then statement
if xresolution=300 then make yresolution= 300
This is what I have so far
exiftool -if '$ xresolution eq "300"' –EXIF: yresolution="300"
would this work? need some help
Remove the space between –EXIF: and yresolution="300" and it should work. Test it out to see if it does what you want.
I just ran the Command
exiftool -if '$ xresolution eq "300"' –EXIF:yresolution="300"
and got warning" Tag 'EXIF:yresolution' is not dfined
Nothing to do.
Works here
C:\>exiftool -G -a -s -*resolution y:\!temp\Test4.jpg
[EXIF] XResolution : 300
[EXIF] YResolution : 200
C:\>exiftool -P -overwrite_original -if "$XResolution eq '300' " -EXIF:YResolution="300" y:\!temp\Test4.jpg
1 image files updated
C:\>exiftool -G -a -s -*resolution y:\!temp\Test4.jpg
[EXIF] XResolution : 300
[EXIF] YResolution : 300
Looking closer, you're using an –, not a hyphen. Also, no space between $ and XResolution.
I am running the command on a unix computer
exiftool -P -overwrite_original -if "$XResolution eq '300' " -EXIF:YResolution="300" /home/pi/Dsktop/
get
0 images files read
to I have the location of the files in the wrong place?
Swap double/single quotes on Linux/Mac. Using double quotes around a dollar sign
$ will cause the shell to interpret it as the start of a shell variable instead of an exiftool tag. So use
-if '$XResolution eq "300" 'Quote from: j99mac on October 05, 2021, 11:41:10 AMto I have the location of the files in the wrong place?
Files and options, with limited exceptions, can be anywhere in the command. Exceptions include the
-Config option (https://exiftool.org/exiftool_pod.html#config-CFGFILE), which must be first in the command. And you can not put things between options that require a second parameter, such as
-if EXPR.
this is what I am putting in
exiftool -P -overwrite_original -if '$XResolution eq "300" ' '-EXIF:YResolution="300" '
still giving an error
this is the error
Not a floating point number for IFD0:YResolution
By adding quotes around the assignment part, you are now trying to set EXIF:YResolution to a value of "300" (quotes included).
Use this
exiftool -P -overwrite_original -if '$XResolution eq "300" ' -EXIF:YResolution=300 file.jpg
Thank you this worked