cowgirl has asked for the wisdom of the Perl Monks concerning the following question:

I am using Image::Magick (PerlMagick) to load a file with dimensions of 250x250 pixels. I then resize it like this:
binmode STDOUT; $background->Crop(geometry =>'100x100'); $background->Set(size=>'100x100'); $background->Set(compression=>'LZW'); $background->Write("gif:-");
However, the image remains 250x250. What am I doing wrong and how can I force it to crop the image? I do not want to use scale as I do not want to scale it.

Replies are listed 'Best First'.
Re: Image::Magick keeps dimensions of loaded file
by traveler (Parson) on Aug 16, 2008 at 22:35 UTC
    Your Crop needs the equivalent of +repage in order to shrink the canvas. I think your Set should be
    $background->Set( page=>'0x0+0+0' );
    to get around the fact that perlmagic (at least in the version I've most recently used) has no repage.
Re: Image::Magick keeps dimensions of loaded file
by cowgirl (Acolyte) on Aug 16, 2008 at 20:15 UTC
    Actually the image is cropped, but the image doesn't change to a smaller size. It just becomes white around the cropped area.
Re: Image::Magick keeps dimensions of loaded file
by Mr. Muskrat (Canon) on Aug 17, 2008 at 14:18 UTC