Page 1 of 1

Problems converting SVG to JPG/PNG

Posted: 2009-07-26T10:56:54-07:00
by alab2679
Hi,

I'm having a problem converting SVG to JPG/PNG images using the convert utility. Some of the SVG elements are rendered garbled but others render as expected. Here is the source svg image:

http://combi.cs.colostate.edu/as/aed.CL00001.svg

and here is the jpg/png output (this is jpg, but they look the same):

http://combi.cs.colostate.edu/as/aed.CL00001.jpg

The command I use is simply:

$> convert aed.CL00001.svg aed.CL00001.jpg

I've used imagemagick a good amount in the past but don't know enough to troubleshoot what's wrong. The behavior is the same on versions 6.4.0 (on Fedora 9, not sure the source, probably a deb) and 6.4.5 (on Ubuntu 9.04, from repo). It used to work and I know some things changed in the way we're generating the SVG images but I have no idea what to change to fix it. I did a bunch of searching on forums and google but couldn't find anything that described my problem, so sorry if I just missed it. Otherwise, any suggestions are greatly appreciated as this is kind of a show stopper for my projects at the moment. Thanks.

- Adam

Re: Problems converting SVG to JPG/PNG

Posted: 2009-08-01T19:03:12-07:00
by anthony
I suggest you install the RSVG library. You may have to rebuild IM to use that library.


You can find out if it is available by looking at the format linging for SVG

Code: Select all

  convert -list format | grep SVG 
For example I get

Code: Select all

     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (RSVG 2.22.3)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (RSVG 2.22.3)
If it lists RSVG for 'SVG' conversion then it uses the external RSVG library to render SVG which is better that the old and incomplete MSVG library.

See IM Examples, Drawing Images, SVG handling
http://www.imagemagick.org/Usage/draw/#svg