5

I would like to render an SVG I've created to a hi-res (600 DPI) PNG. This SVG has filter effects, specifically gaussian blur.

Ideally rendering could be done via the command line.

I know the SVG is renderable because you can open it in Chrome/Chromium and the output I'd like to see is there.

Things I've tried:

Importing to Adobe Illustrator

svg2png

Imagemagick

Inkscape

Other command-line tools and programs I'm forgetting right now. Basically anything you could find with Google.

Current path I'm pursuing but stuck on:

Knowing that Chromium can render the SVG just fine and that it's open-source, I figured I'd download the library Chromium depends on to render SVGs (Skia, https://sites.google.com/site/skiadocs/) and use it to output a PNG. So far I've succeeded in installing Skia and running the very first example. I've found an example that renders an SVG (https://code.google.com/p/skia/source/browse/trunk/samplecode/SampleSVG.cpp?r=875) but haven't successfully run it on my OSX machine with the latest updates to XCode and command-line tools. A modified version of that example (with gyp file) that outputs a PNG would be amazing.

Other ideas that might work:

Getting pixel data from Chrome (how would I do that? A simple screenshot isn't enough because of the resolution of the image. I also want a scriptable, repeatable process.)

Using other graphics library that can render SVG. Maybe this comes from other web browsers, maybe not.

Community
  • 1
  • 1
leggers
  • 53
  • 1
  • 4

1 Answers1

3

This seems to work nicely:

webkit2png -F blue.svg -o rendered

The -F says to generate the Full resolution PNG and no thumbnails, and the -o specified that the output filename will be rendered-full.png.

enter image description here

I have reduced the size so it fits on Stack Overflow, but the command shown actually gives the full-resolution 2880x2880 image.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432