Lives On Board

/ My MetaSphere /

Wed Jul 16, 2003

Flash MX Hosting
Web Hosting
Web Tools
Help FAQ
Marketing
Portfolio
Contact
Site Chat
Web Search
Asheville NC
Boards
Network Log
Got Flash?
Web Links

Need Help?
We are online if image is green.
We are online if this image is green. Click here to chat live with metasphere.net.

Flash Video Guestbook.
Watch, Record & Browse through our Video guestbook.

Flash Hosting with MetaSphere

Today in History:
1948: John J. Pershing, military commander whose brilliant career earned him the title General of the Armies of the United States, died.

Metasphere.net
Asheville, NC



Help FAQ Index / Search
Help FAQ PERL
Previous Page in Help FAQ Tour Next Page in Help FAQ Tour
Help FAQ

Hello World ImageMagick Draw Command Show All PERL Help Files

Output from helloworld.cgi using imagemagick to read an image called "map.gif" and draw rectangles and circles on top of the map image. Finally outputs the image to a browser with the proper content-type for a gif file. Download the Map here.

Perl Source Code:


#!/usr/bin/perl
binmode STDOUT;
print "Content-type: image/gif\n\n";
use Image::Magick;
my($image, $status);
$image = Image::Magick->new;
$image->Read("map.gif");
$image->Draw(primitive=>'FillRectangle',points=>"10,10 60,80",pen=>'#FFFF00');
$image->Draw(primitive=>'Rectangle',points=>"10,10 190,190",pen=>"blue",linewidth=>2);
$image->Draw(primitive=>'Rectangle',points=>"44,44 122,122",pen=>"blue",linewidth=>1);
$image->Draw(primitive=>'Circle',points=>"50,50 45,32",pen=>"green",linewidth=>5);
$image->Draw(primitive=>'Rectangle',points=>"14,14 187,187",pen=>"white",linewidth=>2);
$image->Draw(primitive=>'Rectangle',points=>"26,24 187,187",pen=>'#AAAA00',linewidth=>4);
$image->Draw(primitive=>'FillRectangle',points=>"110,112 135,136",pen=>"white",linewidth=>1);
$image->Write('gif:-');
undef $image;


And here's another simple ImageMagick script which resizes an image nnn.jpg. This is written in Perl and runs on our server.

#!/usr/bin/perl
use Image::Magick;
my(, );
 = Image::Magick->new;
print "Content-type: image/jpeg\n\n";
binmode STDOUT;
->Read("nnn.jpg");
->Scale("50x50");
->Write('jpg:-');
undef ;
exit;




Here's the code working.

Contact Metasphere.net


Add Page to favorites/bookmarks.