ExifTool Forum

ExifTool => Newbies => Topic started by: lmatias on March 27, 2023, 06:28:23 AM

Title: Portrait (vertical) Landscape (horizontal) format
Post by: lmatias on March 27, 2023, 06:28:23 AM
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
Title: Re: Portrait (vertical) Landscape (horizontal) format
Post by: Phil Harvey on March 27, 2023, 09:26:37 AM
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
Title: Re: Portrait (vertical) Landscape (horizontal) format
Post by: lmatias on March 27, 2023, 10:19:25 AM
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
Title: Re: Portrait (vertical) Landscape (horizontal) format
Post by: Phil Harvey on March 27, 2023, 10:31:42 AM
The sample config file (https://exiftool.org/config.html) 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
Title: Re: Portrait (vertical) Landscape (horizontal) format
Post by: lmatias on March 27, 2023, 11:07:02 AM
Quote from: Phil Harvey on March 27, 2023, 10:31:42 AMThe sample config file (https://exiftool.org/config.html) 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