Page 1 of 1

Convert Command Line script to PerlMagick (flag issues)

Posted: 2012-03-08T07:51:39-07:00
by hs2323
Hi All,

I am trying to convert the following command from the command line, but can't seem to get it working in PerlMagick (don't know if it is even possible).

convert image.jpg -crop 3x3@ +repage +adjoin image_3x3@_%d.jpg (http://www.imagemagick.org/Usage/crop/#crop_equal)
It takes an image and divides it into (almost)equal parts(9 blocks). For some reason I can't get it to work in Perl.

Here is what I have:

Code: Select all

my $pCrop = Image::Magick->New();
$pCrop->Read($imagePath);
$pCrop->Crop(geometry => '3x3@');
$pCrop->Set(page=>'0x0+0+0');
$pCrop->Set(adjoin=> 0);
$pCrop->Read($imagePath);
It crops the image into 1 3x3 square. I even tried reordering the commands. It seems like it doesn't accept the '@' flag. Is there any way to convert the command line script at the top?