Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library to parse SVG in Ruby or Python [closed]

Tags:

python

ruby

svg

SVG is a huge standard, which is based on XML. I have parsed SVG as XML in the past. However, some things are hard.

For example, I would like to know the size of a group. As far as I can tell, this is only possible by recursively stepping through all the children in the group (noting all their transformations) and accumulating their sizes.

I would love to have a library that could do stuff like that for me. Does something like this exist?

like image 860
bastibe Avatar asked Dec 16 '11 12:12

bastibe


1 Answers

In python you have pysvg:

import pysvg.parser

svg = pysvg.parser.parse(<filename>)
print svg.get_width(), svg.get_height()
like image 84
jcollado Avatar answered Oct 15 '22 11:10

jcollado