Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
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:
#!/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
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.
This appears to be the correct format and syntax to get the width and height for a given image. It should work. However, you might use miff:- in place of - for the output before the pipe.
Otherwise, check your IM version and be sure you are on a current version and not one that is very old.
If any images have spaces in them, then you should use quotes around the filenames
actually it seems that my IM does not know whether the picture was taken in a landscape or portrait mode; it handles the portrait pictures in a landscape orientation.
Finally, this is not so disturbing to me... though it is strange and I was not able to correct it (I updated from IM 6.6.5 to 6.6.6).