Page 1 of 1

Extracting image orientation from a JPEG

Posted: 2017-12-13T07:42:15-07:00
by Desch
Hi,
I'm a Windows 10 user and I want to determine the resolution or orientation (portrait or landscape) of my image files. When I use the following command-line, everything works fine:

magick identify -format "%i:%W:%H\r\n" *.jpg

RESULTS (filename:width:height) :
1.jpg:1920:1080
2.jpg:1920:1080

When I try the same thing in the following batch file (image.cmd):

@echo off
cd "%userprofile%\Pictures"
erase /F image_list
magick identify -format "%i:%W:%H\r\n" *.jpg >> image_list

I get the following RESULTS:
W:H
W:H

WHY ? Can anyone help me or is there a simplier way to do that ?

Thanks!

Desch

Re: Extracting image orientation from a JPEG

Posted: 2017-12-13T07:51:24-07:00
by snibgo
In Windows BAT files, percent % has a special meaning. When you don't want that special meaning, you need to double it:

Code: Select all

magick identify -format "%%i:%%W:%%H\r\n" *.jpg >> image_list

Re: Extracting image orientation from a JPEG

Posted: 2017-12-13T08:24:10-07:00
by Desch
Hi snibgo,

I forgot that little detail, it seems to work now, thanks!

Desch