Cropping all images to uniform size....

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
johnoyler

Cropping all images to uniform size....

Post by johnoyler »

Is it possible to use Crop() so that if you have an image that is smaller than the size you're changing it to, that it will expand the image to that size? I'd prefer that the extra area be white.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Cropping all images to uniform size....

Post by anthony »

there is a little trick. crop the image as normal, but add a '!' flag. This makes the virtual canvas from crop that same size as the crop. The images offset is set to poistion the image in this area right too.

now set the background and flatten it. the flatten will fill out the image to the virtual canvas size, and set the backgound to the color given (can be transparent if you like).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply