ExifTool Forum

ExifTool => Newbies => Topic started by: felciano on November 16, 2018, 10:40:11 PM

Title: Correct use of conditional -if to check for image orientation (rotation)?
Post by: felciano on November 16, 2018, 10:40:11 PM
Hi --

I'm trying to learn how to use EXIFTool to process images that have been rotated. I've browsing the forums to try to address this and have been trying to implement the syntax illustrated in https://exiftool.org/forum/index.php/topic,6466.msg32225.html#msg32225. However I seem to not quite have the conditional syntax down correctly:

MiMac:dircheck$ exiftool -Orientation "rotatetest/rotated 2016-01-22 12.50.55 (iPhone 6).jpg_original"
Orientation                     : Rotate 90 CW
MiMac:dircheck$ exiftool -if "$orientation and $orientation =~ /(90|270)/" "rotatetest/rotated 2016-01-22 12.50.55 (iPhone 6).jpg_original"
    1 files failed condition
MiMac:dircheck$

I've tried various configurations but it always ends up with a "failed condition" message. What am I missing?

Thanks, in advance,

Ramon
Title: Re: Correct use of conditional -if to check for image orientation (rotation)?
Post by: StarGeek on November 17, 2018, 12:06:59 AM
On a Mac?  Swap single/double quotes.

Double quotes cause $orientation to be treated as a shell variable.
Title: Re: Correct use of conditional -if to check for image orientation (rotation)?
Post by: felciano on November 17, 2018, 12:38:57 AM
Wow -- I never would have caught that! Thank you -- works perfectly now.

Ramon