crop + page different in command line to perl

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Posts: 10
Joined: 2012-10-21T01:12:07-07:00
Authentication code: 67789

crop + page different in command line to perl

Post by mack3457 »


If I use

Code: Select all

convert input.tif -crop 400x300+301-143 -page 400x300+0+143 output.gif
I get the desired result, which is a 400x300 pixel image with the top 143 pixel blank.

When I'm using the perlmagick version of it:

Code: Select all

$image->Crop(geometry => "400x300+301-143");
$image->Set(page => "400x300+0+143");
I end up with a 300x400 pixel image file of a horizontal image strip starting at 143 pixel from the top: the rest is blank.

For some funny reason, geometries of

Code: Select all

-crop 400x300-99-143 -page 400x300+99+143
give me the desired result in perlmagick as well.

What am I missing here?

Thomas Mack

User avatar
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: crop + page different in command line to perl

Post by anthony »

Set page is equivelent to doing a -repage which sets virtual canvas information on the image.

What you want to do is set the page for the write (image info). I am not however certain how you would do this in PerlMagick though.

It should however be the same as setting the page before reading an image, so a read postscript example may provide the answer.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages