I am calling a single IM command in Perl to crop an animated GIF. After "cropping" the resulting image is still the same size. Rather than cropping, the IM command appears to have cleared the background everywhere except the cropped region. The original image and resulting image are at the following links:
(original) http://www.twopalm.com/im/test.gif
(cropped) http://www.twopalm.com/im/crop.gif
Here is the script I used that shows the cropping command issued:
Code: Select all
#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
my $htmldir = "/var/www/vhosts/twopalm.com/httpdocs/";
my $testdir = $htmldir.'im/';
my $cropx = 100;
my $cropy = 100;
my $cropw = 100;
my $croph = 100;
my $origfile = $testdir.'test.gif';
my $cropfile = $testdir.'crop.gif';
my $result = system("/usr/bin/convert", "$origfile", "-crop", "$cropw x $croph + $cropx + $cropy\!", "$cropfile");
print "Content-Type: text/html; charset=utf-8\n\n";
print "$result\n";
exit;