converting SVG & passing parameters to another perl script

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
geology_alex

converting SVG & passing parameters to another perl script

Post by geology_alex »

Hello,

I have a perl program which i use to dynamically generate SVG graphics. My graphic is generated from a Perl script using a URL from which i pass parameters, for example "http://localhost/cgi-bin/svgmaker.pl?a=20&b=10&c=5&d=30" and when i run this in Firefox web browser my SVG image is generated.

I would like to use PerlMagick/Imagemagick to create an itermediate program to convert this SVG into a PNG graphic so i can display in windows explorer, but im having some trouble passing the parameters through my imagemagick script into my Perl-SVG script (script below). I'm not sure if its a problem with my Perl Script (im new to perl too) or with the capabilities of imagemagick but i'd be grateful for any help with this
Thanks!

#!C:/Perl/bin/perl.exe -w
#
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Image::Magick;

my $a = 0;
my $b = 0;
my $c = 0;
my $d = 0;

if (param('a')) { $a = param('a'); }
if (param('b')) { $b = param('b'); }
if (param('c')) { $c = param('c'); }
if (param('d')) { $d = param('d'); }

my $image = new Image::Magick;
my $status = $image->Read('http://localhost/cgi-bin/svgmaker.pl?a= ... &c=$c&d=$d');
die "$status\n" if $status;

print "Content-type: image/png\n\n";
binmode STDOUT;

$image->Write('png:-');

undef $image;

##
Post Reply