Re: Converting images with padding or cropping on left and right
- From: Lars Haugseth <njus@xxxxxxxxxxxxxxxx>
- Date: 23 Sep 2007 19:50:08 +0200
* Tuxedo <tuxedo@xxxxxxxxxxxxxx> wrote:
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
When a resulting thumbnail image become less than 100 pixels wide I'd like
to add padding on left and right in some solid color, making the jpeg
including the solid area, to exactly 100 pixels wide.
If however a resulting thumbnail is wider than 100 pixels, I'd like it
cropped equally, or to the nearest pixel, on the left and right edges, so
that it becomes exactly 100 pixels wide.
This is like placing the resulting 75 pixes tall image in the center
of a canvas which is exactly 100x75 pixels, and discarding the excess area
if any.
I'm not sure if this can be done with the Image Magick toolset alone, and
if not, is there an easy way to do this using PerlMagick?
This is easily done using -border/-crop on the command line, or with
PerlMagick using Border/Crop methods.
--
Lars Haugseth
"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer
.
- Follow-Ups:
- References:
- Prev by Date: Converting images with padding or cropping on left and right
- Next by Date: Re: RFC: Crypt::Skip32 - 32-bit block cipher based on Skipjack
- Previous by thread: Converting images with padding or cropping on left and right
- Next by thread: Re: Converting images with padding or cropping on left and right
- Index(es):
Relevant Pages
|
|