Lives On Board

/ My MetaSphere /

Wed Dec 3, 2003

Flash MX Hosting
Web Hosting
Web Tools
Help FAQ
Marketing
Portfolio
Contact
Site Chat
Web Search
Asheville NC
NEW!!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.

We are proud to host Acoustic Syndicate.
acousticsyndicate.com

Flash Hosting with MetaSphere

Today in History:
1818: Illinois entered the Union as the 21st state.

Metasphere.net
Asheville, NC
Help/FAQ Index / Search
Help/FAQ
Previous Page in Help/FAQ Tour Next Page in Help/FAQ Tour
Return to Main Page in Help/FAQ

Hello World ImageMagick Draw Command

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::Magick->new;
->Read("map.gif");
->Draw(primitive=>'FillRectangle',points=>"10,10 60,80",pen=>'#FFFF00');
->Draw(primitive=>'Rectangle',points=>"10,10 190,190",pen=>"blue",linewidth=>2);
->Draw(primitive=>'Rectangle',points=>"44,44 122,122",pen=>"blue",linewidth=>1);
->Draw(primitive=>'Circle',points=>"50,50 45,32",pen=>"green",linewidth=>5);
->Draw(primitive=>'Rectangle',points=>"14,14 187,187",pen=>"white",linewidth=>2);
->Draw(primitive=>'Rectangle',points=>"26,24 187,187",pen=>'#AAAA00',linewidth=>4);
->Draw(primitive=>'FillRectangle',points=>"110,112 135,136",pen=>"white",linewidth=>1);
->Write('gif:-');
undef ;


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.



Refresh / Add Page to favorites/bookmarks.