Converting Inkscape to Synfig (Python code)

So, I had the problem that I design my figures in Inkscape (.sfg format), and I wanted to animate them in Synfig.

To keep track of everything, I put the different body parts on different layers, and within the layers, I use groups which I name using the “ID” property.


  • If I import this file from the Synfig application, some shapes aren’t converted at all, others, not correctly. Moreover, Inkscape layers and groups end up in Synfig layers described as “Inline Canvas”, which isn’t that helpful to keep track on what is what.
  • If I convert the file within Inkscape 0.92 to .sif format, it keeps the layers, but it only converts some of the groups to layers, and for those that it does, it doesn’t convert their IDs into layer descriptions. On some figures, parts get randomly displaced.
  • If I convert the file within Inkscape 1.0 to .sif format, then the process doesn’t halt. I have to kill Inkscape to make it exit.

So this unsatisfactory state of affairs has annoyed me enough that I got to work and fixed the Inkscape code that converts .svg files to .sif . It’s Python code that can be used standalone (All the modules it relies on can be obtained via standard “pip install”) with a call such as

python3 < “FILE.svg” > “FILE.sif”

It only generates an oldish .sif format, but:

  • it converts all explicit Inkscape groups to Synfig layers without gobbling any of them
  • it converts all the shapes, not only paths (however, all .svg shapes end up as Synfig paths)
  • it gives the Synfig layers sensible descriptions, making use of the ID field of Inkscape groups or the description field of Inkscape layers.

So here’s the code.

The code is GPL’d – original by Nikita Kitaev – and I don’t claim copyright on my puny, puny modifications, so feel free to make use of it if you want. Or at least it might help someone sometime.

I’d do more, but as far as I understand, you can only sensibly code for Synfig if you have a Fedora or at least a Linux box, and I currently don’t.

I’d include pictures in this post that show the issues, but the system won’t let me.



Thank you for your contribution!

You can code on Windows or MacOS too.
Check :slight_smile:

Virtualbox is your friend :wink: