Page 1 of 1

Enlarge image canvas using ImageMagic

Posted: 2010-12-27T23:27:27-07:00
by Sergio
I've been learning about ImageMagick & it's great! For the most part, I can learn on my own, though the one thing that I can't learn to do is to expand the canvas size. So if the ratio is 3x2, I want to add extra white space to make it 3x3. If I use the -geometry function, it enlarges the image to the proportions I want, but it loses the aspect ratio.

If you turn to page 377 (or 388 in PDF) of the User Manual, under "Montage", you'll see that ImageMagic can do what I want. The thumbnails in the example image are all of different proportions but the alloted space is 1x1 for all. However the documentation on this function is pretty bad! Does anyone know how to do this?

Thanks!

Re: Enlarge image canvas using ImageMagic

Posted: 2010-12-28T10:29:02-07:00
by fmw42
see -extent, but you need to compute the aspect ratio you want into pixels (and you can use -geometry to position it for center or the sides or corner)

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

You can also use -border http://www.imagemagick.org/Usage/crop/#border

Or try my shell script, aspectpad, at the link below (for linux,mac or windows cygwin)

Re: Enlarge image canvas using ImageMagic

Posted: 2010-12-28T11:00:00-07:00
by Sergio
YES! That's exactly what I was looking for. It's going to take a little more doing because I have to calculate height vs width, but it's all in good fun anyway. By the way, your page is AMAZING! It's chock full of scripts, but the impressive part is the documentation and matching pictures! I will make very good use of this page. Thanks!