|
Posted by Lars Haugseth on September 23, 2007, 1:50 pm
Please log in for more thread options
>
> 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
|