Problems converting SVG to JPG/PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
alab2679

Problems converting SVG to JPG/PNG

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems converting SVG to JPG/PNG

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply