SVG import/export

Anyone worked with SVG import/export? I see a few libraries for doing that, this one pops out as being pretty useful for export:

just thought I’d see if anyone had looked into this. Also, EPS import would be interesting, probably a big project. I googled around but nothing jumped out at me. Thanks for any advice.

I would enthusiastically recommend cairo ( for svg export. Cool thing about cairo is you can render to an image, svg, pdf, postscript and more. And it has up-to-date python bindings, which I’ve been using a lot lately. The multiple backends thing is very sweet.

I don’t have experience with using cairo to render svg. There is a library called librsvg which I believe uses cairo, though I don’t know what its status is.

Another library which bears mentioning in this context is antigrain ( It seems to be substantially faster than cairo, though so far as I know it only renders to images. It has a minimal – but probably sufficient for most – svg renderer.


Is there anyway to get transparency?

GL2PS worked great for me. It exports postscript but I am not sure about transparency.

I am pretty sure transparency is not supported in the original postscript spec.
That is why ofxVectorGraphics can’t do alpha.

I think Extended Postscript(EPS) and PDF both have alpha.

At some point I think it would be great to add pdf support to OF.
Depending on the complexity it could be added into ofxVectorGraphics so that you could choose your output type.


This looks like it would be fun to hookup.

Haru PDF library - you can embed images and true type fonts too.
Would be great for computer generated posters!


Generating posters and print ready graphics is what I’m interested in doing, so yeah, libhaur looks good. I think ofxVGrfx could be nicely extended so you could spit out EPS, SVG, or PDF. The import question is a different one though. I think it would be pretty sweet to be able to bring in an SVG graphic, parse it, do the drawing, and have some appropriate data structure generated as well…hmm. Sounds like I’ve got a bit of work to do :slight_smile: I suppose while we’re talking about parsing up file formats, reading a PS file into a drawing instruction set would be cool. Probably pretty hard to get perfect. But even in basic form it’d be cool.

Thanks for all the pointers and @kefex, those are some sweet video fx you’ve got on your site!