How to re-size canvas to a fixed aspect ratio ?

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?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

See 'Padding out an image' in IM Examples, Resize
http://www.cit.gu.edu.au/~anthony/graph ... space_fill

Also more details examples of 'padding' in given in Thumbnails..
http://www.cit.gu.edu.au/~anthony/graph ... nails/#pad
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

For your case where you are actually changing aspect ratios, probably.
but if your images are all the same size you only need to compute this once.

Note -border may not be the right solution as it always adds two pixels each time,
one on each side of the image. This was a problem that was looked at in an answer to someone designing CD covers, and also needed padding.

Specific sized images, without resize
http://www.cit.gu.edu.au/~anthony/graph ... /#cd_cover

This will ne merged into some other section at some point in the distant future.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply