J
J
jil2012-06-01 17:09:23
.NET
jil, 2012-06-01 17:09:23

Library for rendering SVG to PNG?

Task: Render an SVG file to PNG (desirable).
It so happened that SVG is built by a Javascript application on the client side. There is a whole complex of construction schemes. The result is a file that opens correctly with GIMP (Inkscape doesn't handle "use" tags).
We need a command/procedure/library that receives an SVG file as an input, and a PNG (or BinaryStream) as an output, for embedding into the ASP.NET (Win32) WEB server.
Attempts to include Cairo, gtk (mono), GIMP API - failed :(
PS: Wouldn't want to use Mono. Performance doesn't really matter. Don't offer *nix tools.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
E
Eddy_Em, 2012-06-01
@Eddy_Em

Meanwhile, ImageMagic also works under Windows...

T
try4tune, 2012-06-01
@try4tune

Apache Batik - we used in a similar project.

S
Seter17, 2012-06-01
@Seter17

Maybe this will help?

E
Eddy_Em, 2012-06-01
@Eddy_Em

Meanwhile, ImageMagic also works under Windows...

F
Finom, 2012-06-02
@Finom

In: code.google.com/p/canvg/
SVG → Canvas
And then you'll figure it out :)

I
Ivan, 2014-01-30
@illus0r

Converted svg to png in batch using Inkscape, you can use it on the console:

# -*- coding: utf-8 -*- 
import os
path=".\\"
dirList=os.listdir(path)
for fname in dirList:
  try:
    if fname[-4:] == ".svg":
      print fname
      os.system('''"C:\Program Files (x86)\Inkscape\inkscape.exe" -z -e %s.png -w 256 -h 256 %s'''%(fname,fname))
  except:
    pass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question