Is there any scripting SVG editor?

2019-04-25 09:01发布

问题:

I would like to edit SVG files using some scripting language (preferably Python). In particular, I would like to merge two SVG files, add some annotations, and arrange them in a larger image. Is there any software available for such purposes?

Thanks,

Bartosz

UPDATE

I finally decided to use the approach proposed by nosklo. You can find the code of SVG handling python module on github repo. I also described how to use it in this post

回答1:

You could use something like lxml - after all SVG files are XML. It's available from PyPI pip: https://pypi.python.org/pypi/lxml/



回答2:

I don't know if you could do what you describe, but Inkscape supports some degree of scripting with Python.



回答3:

Very late answer, but in case it helps anyone, I have written an very small extension for Inkscape that allows writing short python code snippets from within Inkscape.

*  http://www.smanohar.com/inkscape.php

You can type up to 5 lines and iterate over objects in the current selection or in an XPath. Includes some code examples.