crop command not working

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
lulu116
Posts: 3
Joined: 2016-03-09T11:30:12-07:00
Authentication code: 1151

crop command not working

Post by lulu116 » 2016-03-09T11:54:21-07:00

hello , first post here :)
I'm trying to crop a HD picture into a mosaic of overlapping pictures.
if I use convert : convert HD.jpg -crop 6x9+233+233@ tmp.gif it works perfectly
but inside a perl script it fails (ie I got only one picture with bad size)
code :

Code: Select all

$HDIMAGE="HD.jpg";
$hd = Image::Magick->new;
$hd->Read($HDIMAGE);
$crop = $hd->Clone();
$GEOMETRY="6x9+233+233@";
$crop->Crop(geometry=>$GEOMETRY);
$crop->Write('tmp.gif');
thanks for any help.
luc

User avatar
magick
Site Admin
Posts: 10692
Joined: 2003-05-31T11:32:55-07:00

Re: crop command not working

Post by magick » 2016-03-09T13:18:38-07:00

One image is expected since you specified a geometry offset. The resulting image is 6x9 but has a virtual canvas of the original image size. You can remove the virtual canvas with this statement:
  • $crop->Set(page=>'0x0+0+0');

lulu116
Posts: 3
Joined: 2016-03-09T11:30:12-07:00
Authentication code: 1151

Re: crop command not working

Post by lulu116 » 2016-03-10T03:18:33-07:00

thanks for your response

what I'm trying to do is something like that :
http://www.imagemagick.org/Usage/crop/#crop_equal
"As a bonus, you can also sub-divide the image so that each tile will 'overlap' its neighbours. You do this by not only using a '@' flag but also specifying the number of pixels of overlap you want."
the output of the convert command is 6*9 = 54 images so I was expecting to have an array of 54 pictures.
maybe it's not feasible in Perl ..

Post Reply