I want to render a significant number of SVG files (containing line art) to PNG format (and possibly other formats), so I'm planning to write a script to do it for me. The problem is that I need to select a program to do the conversion step. The established solutions are rsvg and Inkscape, and I don't want to use either one.

When I render an image with rsvg, I notice that orthogonal lines which connect to other lines tend to have faint shadows on their "inner" side that fade toward one end (for example, a <rect/> tends to have these on the inside of each edge, fading as they go clockwise, except at the top for some reason). These shadows are almost impossible to see without 3x zoom or more, but they can still make the lines look fuzzy. I would feel sloppy rendering images to a raster format looking like that, especially since my line art contains many orthogonal lines.

ImageMagick uses rsvg to handle SVG files. This means that any SVG I render with ImageMagick will have the same problem. I wouldn't mind using it if I could change the SVG delegate, though.

I don't know what Inkscape's output looks like because I haven't used it for a long time. It relies on a long list of useless GNOME libraries and programs that would make a mess of my system, which I spent a long time cleaning after the last time I used GNOME. I don't want to try that again just to see if the quality is better.

The last thing I tried was a program called Anti-Grain Geometry, which seems to be unmaintained and wouldn't compile.


I tried PhatomJS' rendering feature and it creates a cleaner render than rsvg.

The bad parts of this solution:

  • It's a rather large program for what I'm doing with it, at about 15 MB

  • It requires scripting in Javascript in addition to my previous scripting

  • It doesn't recognize SVG as easily as rsvg does, forcing the additional complication of wrapping the SVGs in HTML

The good:

  • PhantomJS relies on very few, common dependencies, so installing it is easy for most users

  • It creates the possibility of fetching files over a network

  • It solves the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.