http://sun.cs.lsus.edu/~rmabry/magick/m ... ndtest.plx
Code: Select all
#!/usr/bin/perl --
use Image::Magick;
$image1 = new Image::Magick;
$image1->Read("logo:");
$image1->Resize('50%'); #needn't be so big for this demo
$image1->Border(width=>4, height=>4, color=>'blue'); #shows up better
($w,$h) = $image1->Get('width', 'height');
$image2 = $image1->Clone(); # two identical images
$image1->AffineTransform(affine=>[1,1,-1,1,0,0]); # any affine matrix can be used here
$image1->Resize("$w x $h!"); # make both images the same size
#uncomment either of the two following and rerun for comparison
# $image2->Draw(primitive=>'line', stroke=>'black', points=>sprintf("0,0 %d,%d", $w-1,$h-1));
# $image2->Set(matte=>'true');
# Now make two stacked images, each stack having the two images in different orders
$image12 = $image1->Clone();
$image21 = $image2->Clone();
$image12->[1] = $image2;
$image21->[1] = $image1;
$image12 = $image12->Append(stack=>'false');
$image21 = $image21->Append(stack=>'false');
# the two images differ, but not in the way I'd have expected
$image12->Border(width=>4, height=>4, color=>'#eeccee'); #shows up better
$image21->Border(width=>4, height=>4, color=>'#eeccee'); #shows up better
$image12->Write("image12.png");
$image21->Write("image21.png");
While I'm at it, I am surprised at the way Border works on the stacked images, too.
This is 6.3.1-4 12/24/06 Q16
I hope everyone stayed home last night and got 'pixellated'.
Rick