Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Image::Magick keeps dimensions of loaded file

by cowgirl (Acolyte)
on Aug 16, 2008 at 19:16 UTC ( [id://704721]=perlquestion: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://704721]
Approved by kyle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-23 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found