Page 1 of 1

Can IM resize and pad the image?

Posted: 2009-04-03T07:29:57-07:00
by pchung99
Hi,
I have an 400x200 jpg. I want a 800x800 jpg. -resize "800x800!" stretches the image. Is there a way to resize and pad the excess space with white or black so I have an image 800x800 without stretching it?

Re: Can IM resize and pad the image?

Posted: 2009-04-03T09:06:48-07:00
by magick
Try the -extent option.

Re: Can IM resize and pad the image?

Posted: 2009-04-03T11:15:11-07:00
by pchung99
That was part I was missing. This is the final code that worked for me.
rs = img.Convert("-resize","800x800","-gravity","center","-extent","800x800","input.jpg","output.jpg")
Thanks for all the help
Great software