montage several images into one and then crop?
Posted: 2010-05-28T09:04:48-07:00
Hello,
I'm looking to montage various seperate images into one single image, and then to crop before returning the resulting image to the web browser. I've been able to do the montage but im not sure how to follow this up with a clip (for example to take the montaged image, and crop 10 pixels off each side). I get errors when i try to do multiple processing functions. My script is below can anyone help me identify where i can add the crop function or where i'm going wrong!? i'm new to using perlmagick and not sure if i'm following the best method of doing the montage either. thanks very much
I'm looking to montage various seperate images into one single image, and then to crop before returning the resulting image to the web browser. I've been able to do the montage but im not sure how to follow this up with a clip (for example to take the montaged image, and crop 10 pixels off each side). I get errors when i try to do multiple processing functions. My script is below can anyone help me identify where i can add the crop function or where i'm going wrong!? i'm new to using perlmagick and not sure if i'm following the best method of doing the montage either. thanks very much
Code: Select all
#!C:/Perl/bin/perl.exe -w
#
#use CGI qw(:standard);
#use CGI::Carp qw(fatalsToBrowser);
use Image::Magick;
# Turn off buffer
$| = 1;
# Build URL request string
my $url = "http://localhost/tiles/0.png" ;
my $url2 = "http://localhost/tiles/1.png" ;
my $url3 = "http://localhost/tiles/2.png" ;
my $url4 = "http://localhost/tiles/3.png" ;
my $url5 = "http://localhost/tiles/13.png" ;
my $url6 = "http://localhost/tiles/12.png" ;
my($image, $status);
$image = new Image::Magick;
$status = $image->Read($url,$url2,$url3,$url4,$url5,$url6);
die "$status\n" if $status;
# stack=>0 is horizontal =>1 is vertical
$status = $image->Montage(geometry=>'256x256+0+0', tile=>'2x3');
# this doesnt work when i add this next line
#$status = $image->Crop(geometry=>'100x100+100+100');
print "Content-type: image/png\n\n";
binmode STDOUT;
$status->Write('png:-');
undef $image;
##