converting SVG & passing parameters to another perl script
Posted: 2009-09-15T09:50:37-07:00
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;
##
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;
##