[magick-users] Converting images with padding or cropping based
on a max-height
Anthony Thyssen
anthony at griffith.edu.au
Sun Sep 23 19:19:24 PDT 2007
Tuxedo on wrote...
| I have a simple shell procedure that batch converts original jpeg's in=20
| 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=20
| wide to add padding on left and right in some solid color, making the=20
| jpeg including the solid area exactly 100 pixels wide.
|
| If however a resulting thumb becomes wider than 100 pixels, I would=20
| then then like it cropped on the left and right edges so it becomes=20
| exactly 100 pixels wide.
|
| This is as if placing the resulting 75 pixes tall image in the center=20
| of a canvas which is exactly 100x75 pixels, and cropping the resulting=20
| thumb only if necessary.
|
| Exactly how can this be done? Which Image Magick methods and tools are=20
| suitable for this? Any examples would be greatly appreciated.
|
See IM Examples, Thumbnails, Padding Out Images...
http://www.imagemagick.org/Usage/thumbnails/#pad
It gives about 4 different techniques in various ways, depending on your
version on IM.
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
-----------------------------------------------------------------------------
My girlfriend's just an object to me. Unfortunately, there is some
information hiding, but thankfully, she's fairly encapsulated, nicely
modular, and has a very well defined interface!
-- Frank Fabbrocino <fabbroci at sal-sun2.usc.edu>
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
More information about the Magick-users
mailing list