[magick-users] Converting images with padding or cropping based on
a max-height
Tuxedo
tuxedo at mailinator.com
Sun Sep 23 03:51:33 PDT 2007
I have a simple shell procedure that batch converts original jpeg's in
various sizes into thumbnail copies maximum 75 pixels in height:
for i in *.jpg
do convert -quality 70 -geometry x75 $i ../img/`basename $i .jpg`.jpg;
done
I'd like it that when a resulting thumb becomes less than 100 pixels
wide to add padding on left and right in some solid color, making the
jpeg including the solid area exactly 100 pixels wide.
If however a resulting thumb becomes wider than 100 pixels, I would
then then like it cropped on the left and right edges so it becomes
exactly 100 pixels wide.
This is as if placing the resulting 75 pixes tall image in the center
of a canvas which is exactly 100x75 pixels, and cropping the resulting
thumb only if necessary.
Exactly how can this be done? Which Image Magick methods and tools are
suitable for this? Any examples would be greatly appreciated.
More information about the Magick-users
mailing list