Stretch the canvas

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
xpt
Posts: 59
Joined: 2010-10-06T20:18:24-07:00
Authentication code: 8675308

Stretch the canvas

Post by xpt »

Hi,

What's the easiest way to stretch an existing image's canvas to a bigger size?

I meant to stretch the *canvas*, the image remains the same size. E.g,
stretching a 300x300 image to 600x400, but the image stays intact, still
300x300 (and better in the middle of the image), but the canvas is
stretched. So "identify" will returns 600x400, but the images looks the same.

Thanks

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stretch the canvas

Post by fmw42 »

convert image -gravity center -background somecolor -extent 640x480 resultimage

see
http://www.imagemagick.org/Usage/crop/#extent

xpt
Posts: 59
Joined: 2010-10-06T20:18:24-07:00
Authentication code: 8675308

Re: Stretch the canvas

Post by xpt »

PERFECT!
Thanks!

Locked