get heigth/width
Posted: 2011-01-05T10:50:53-07:00
Hi all,
I am new to Image Magick and am trying to retrieve the width and height of an image so that I can name it in a different way whether it is a landscape or portrait image.
Here is my code:
I do get values for width and height, but the width is always 3456px and height always 2592px whereas my images definitely have different orientations, therefore, some images should be 2592px wide and 3456px high.
Can anyone help me?
G.
I am new to Image Magick and am trying to retrieve the width and height of an image so that I can name it in a different way whether it is a landscape or portrait image.
Here is my code:
Code: Select all
#!/bin/sh
for x in `ls originaux`
do
width=`convert originaux/$x -format "%[fx:w]" info:`
height=`convert originaux/$x -format "%[fx:h]" info:`
if [ $height -lt $width ]
then
convert originaux/$x -rotate "2" - | convert - -shave 98x119 rotation/pa_$x
else
convert originaux/$x -rotate "2" - | convert - -shave 119x98 rotation/po_$x
fi
done
Can anyone help me?
G.