make command to write to resolution

Started by j99mac, October 05, 2021, 09:44:27 AM

Previous topic - Next topic

j99mac

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

StarGeek

Remove the space between –EXIF: and yresolution="300" and it should work.  Test it out to see if it does what you want.

* 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).

j99mac

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.

StarGeek

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.
* 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).

j99mac

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?

StarGeek

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, which must be first in the command.  And you can not put things between options that require a second parameter, such as -if EXPR.
* 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).

j99mac

#6
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

StarGeek

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
* 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).

j99mac