Page 1 of 1

Resize and pad instead of stretch

Posted: 2009-04-10T09:48:02-07:00
by daviddoria
If I do this:

Code: Select all

convert File.jpg -resize 100x100\! Output.jpg
It will result in a 100x100 image, but if the aspect ratio has changed, the image will be stretched to fit the new ratio. Is there anyway to say "reduce so one of the dimensions to fits the aspect ratio, and pad with black (or white or something else) so that the picture is not stretched"?

Thanks,

Dave

Re: Resize and pad instead of stretch

Posted: 2009-04-10T10:28:29-07:00
by Bonzo
You want to use -extent:

Code: Select all

convert img1b.jpg -resize 100x100 -background black -gravity center -extent 100x100 david.png

Re: Resize and pad instead of stretch

Posted: 2009-04-10T10:39:04-07:00
by daviddoria
perfect, thanks!