Get orientation from JPEG images

Started by weedinner, August 30, 2016, 10:30:03 AM

Previous topic - Next topic

weedinner

Real command line newbie here so....
I am writing an applescript workflow and need to get the orientation of JPEG images as shot. The (info for theImage) command in AS does not provide the data so I looked at other ways. It appears that the orientation tag in exiftool for works fine on fresh images straight from the camera but when the images are retouched the orientation marker returns
Make                            : Canon
Camera Model Name               : Canon EOS 5D Mark III
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72

despite wether the image displays landscape or portrait.
Am I looking at the wrong tag/doing something hopelessly wrong or is this a bug

I am attaching 2 sample images of both orientations

Phil Harvey

You must use the Orientation tag in conjunction with the image dimensions (ImageWidth/ImageHeight) to determine whether the image is landscape or portrait.  The following command will print the names of all landscape images in a directory:

exiftool -if '$imagewidth > $imageheight xor (defined $orientation and $orientation# > 4)' -p '$filename' DIR

- Phil
...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 ($).

weedinner

Thanks Phil it would have taken me ages to work that out and I simply have not got the time right now. works perfectly on a directory but I might need it to analyse one image at a time. Do you have code for that?
(I have promised myself a terminal tutorial   one day!)

StarGeek

Same command but replace DIR with the full path to a single file.
"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