W3C home > Mailing lists > Public > www-svg@w3.org > May 2003

re: svg convertion tools

From: Fred P. <fprog26@hotmail.com>
Date: Mon, 26 May 2003 15:33:41 -0400
To: pgrab@IA.AGH.edu.PL, www-svg@w3.org
Message-ID: <BAY2-F50ApwOLZCHusM0002476f@hotmail.com>

>>Hi there,
>>I already tested your product and it's far from professional,
>>since it does not convert a graphic file into an 100% IDENTICAL SVG 
>>compared to lets say my free LGPL perl script that can be embedded into 
>>Apache easily.
>>A 100% raster to SVG conversion: BMP --> PNG -->SVG
>>Your tool is more appropriate for cartoonist than for actual professional 
>>usage, as far as I'm concern and I would not recommand it for any serious 
>>not mentionning it's usage limitation since it's not scriptable and it's 
>>I was looking for a simple shape filler to further optimize the SVG 
>>conversion and make it zoomable.
>>Have a nice day.
>Hi Fred,
>I tried to test your png2.svg.pl tool.'

>A problem appeared - I've obtained
>a svg output from my png source file but without any header

That's normal, you probably didn't specify the second HEADER argument! =)

>(perl 5.6.1+ gd library + dumper/version 2.102 as 2.12 refused to work!).

This is the correct version of perl and modules,
Perl 5.8.x gd library is incomplete, still missing some ported modules.

>Shall I do this manually?

If you want else, use the HEADER parameter like stated in the script:

From the script comments:

###   C:\> bmp2png -0      file1.bmp
###   C:\> perl png2svg.pl  file1.png  HEADER
###   C:\> bmp2png -0      file2.bmp
###   C:\> perl png2svg.pl  file2.png
###   C:\> bmp2png -0      file3.bmp
###   C:\> perl png2svg.pl  file3.png
###   C:\> copy /b file1.svg+file2.svg+file3.svg  fileall.svg

C:\> perl   png2svg.pl   file1.png   HEADER

will create you an SVG with SVG header and footer

The normal one is mostly if you want to merge MANY png in one file,
without having to remove manually all the header and footer.

>Can I modify the inside of png2svg.pl to get a header which steers 
>GDI+SVG+MATHML Mozilla enabled browser?

with HEADER, you should get

<?xml version="1.0" encoding="iso-8859-1"?>
<svg height="600" width="1000"

from openSVG  if ( $WANT_HEADER ) being set as $ARGV[1]

also you will get the FOOTER


loops on   <use xlink:href='#". $data[$k] ."' x='$x' y='$y' />


I should probably make them seperate
(have an HEADER and a FOOTER parameter)
such that batch files can be created more easily.
I tried it out on Netscape 4, IE5 and the latest Mozilla on Windows,
all with the same SVG Adobe plugin.

BTW, feel free to modify the code as you may need, it's free of use under 

This version will create basically pixelized images, since it simply draw 
I'm working on a version which will draw filled <path> instead from outside 
to inside,
with a transform="translate( 0.5, 0.5 )" or similar, see:


and the hand example from:

The last one shows that there is no difference from the BMP to the SVG
in aliased more using <path> instead of <rect>,
while being crisp and sharp, without pixelization when you zoom in.


You could use the Zlib Perl module to compress it with gzip
and also qx( ) to run bmp2png directly.

The gzip compression is VERY high, in fact, an SVG compressed file
is smaller than the equivalent GIF file for most icons.

What I really like from this, is that you can bind it in Apache as is or 
with mod_perl
and generate on the fly SVG from a database or XML backend
directly on a production web server.

Sincerely yours,
Fred P.

The new MSN 8: smart spam protection and 2 months FREE*  
Received on Monday, 26 May 2003 15:33:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:56 UTC