Portrait (vertical) Landscape (horizontal) format

Started by lmatias, March 27, 2023, 06:28:23 AM

Previous topic - Next topic

lmatias

Hi
I'm looking for help to be able to extract information regarding the photo format: portrait/landscape or vertical/horizontal.

I'm not understanding the -if statement to achieve that with a command line like it would in VBasic:
if(-ImageHeight > -ImageWidth; "V";"H") or else
if(-ImageHeight / -ImageWidth>1;"V";"H")

obtaining as a result, in addition to the file name, the letter V or H, in CSV file

or is there any TAG that makes this identification?

thanks

Phil Harvey

This is tricky because you also need to account for image Orientation.  Attached is a config file that will give you what you want using this command:

exiftool -config horv.config -p "$filename,$horv" 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 ($).

lmatias

Thanks Phil, it worked perfectly.  :)  :D
By the way do you have any tutorial to make config files?


Probably I'm asking to much... If so, you can say it loudly.

Is there any way of making the statistics of portrait/landscape files?
Obtaining a txt file with the number of files of each format, f.ex., for a total of 40 files:
Portrait (or V), 16
Landscape (or H), 24

Thanks again

Phil Harvey

The sample config file contains examples and information about the config file.

This command will give you this count for JPG images in directory DIR:

exiftool -config horv.config -ext jpg -if "$horv eq 'H'" -aaa DIR

This will give an output with the number of failed files (ie. the Vertical images), and the number of processed files (ie. the Horizontal images).

(The "-aaa" was added as a non-existent tag name to suppress all tags in the output.)

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

lmatias

#4
Quote from: Phil Harvey on March 27, 2023, 10:31:42 AMThe sample config file contains examples and information about the config file.

This command will give you this count for JPG images in directory DIR:

exiftool -config horv.config -ext jpg -if "$horv eq 'H'" -aaa DIR

This will give an output with the number of failed files (ie. the Vertical images), and the number of processed files (ie. the Horizontal images).

(The "-aaa" was added as a non-existent tag name to suppress all tags in the output.)


Thanks Phil

The command line I used is:
exiftool -config horv.config -ext jpg -if "$horv eq 'H'" -aaa U:\Arquivo2\Pessoal\Fotos > exifcount.txt > exifcount.txt

The result is:
======== U:/Arquivo2/Pessoal/Fotos/_D2C0876.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C0877.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C0969.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C0985.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C0986.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1001.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1003.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1052.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1053.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1070.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1102.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1103.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1108.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1177.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1178.jpg
======== U:/Arquivo2/Pessoal/Fotos/_D2C1188.jpg
    1 directories scanned
  26 files failed condition
  16 image files read