svg import problem

I have traced some images in Inkscape 0.48 and saved them as plain svg.
When I import them into Synfig, some parts that should be open are closed.
I attached a simplified example svg file.
If you open this file in Inkscape you will see a simple black round line.
If you import the file in Synfig you will see a filled round figure.

Can anyone see what the problem with this svg is?
Thanks in advance,
Joep Admiraal
test4.svg

Whilst Inkscape puts the two shapes together as an object, Synfig seems to treat each path separately.

Try this…

Select the inner path and make sure this path is above the larger outer path by raising the layer up.

Now, whilst the inner path is selected, go to the PARAMS and set the “Blend Method” to “Alpha Over”.

That should get the effect you want. Try putting a coloured shape beneath to see the result.

Morn.

Hi Morn,

Thanks for your reply.
The steps you provided do give the correct results.
Do you have any idea which program is interpreting the svg file correctly?
Since both programs render the file differently I assume one of them is right.

I wouldn’t say that any of them is wrong…it’s just something that’s lost in translation.

M.

Ok, but say I want to make it possible to import the drawings from Inkscape to Synfig without (a lot of) manually editing the file in Synfig.
Should I look at the import (or rendering) code from Synfig, or the saving code from Inkscape?

Oh I see - you want to work on the code!

I’m not a programmer Joep so I don’t know - sorry. Genete may be able to answer that for you.

Inkscape outputs and reads the file OK so - if I had to guess - I would say it’s probably the Synfig code where it imports SVG files that you would need to look at. It must open and parse the SVG file.

Morn

yeah I’m a coder
However, I don’t have any experience with the Synfig or svg code so I doubt my attempts will lead to anything usefull :mrgreen:

The SVG import support is partial. We are improving the bad results when we have time. Definitively if you want to help, you should look the Synfig’s SVG import code. I haven’t written it nor corrected it in any time, but any kind of help is welcome.
If you start to look the code to fix anything, please don’t doubt to ask here or at the mailing list about synfig concepts. We will help as much as we can.
-G

Hi Joep.

As Genete said, our support for SVG at the moment is still far from complete. It’s such a large standard that even companies like Microsoft or projects like Inkscape take years to get SVG support working properly.

Our current status is something like this:

What does work:
Simple paths and colors
Groups and transformations
Gradients, except for a few special cases

What doesn’t work:
Blending, filters, and other effects
Clones and linking
Shapes that aren’t paths
Multiple subpaths in a shape (the problem you’re having, which also affects the way text is imported into Synfig)
Other features like animation

Your particular problem has to do with the fact that SVG allows for multiple paths in the same shape and has rules regarding which parts to shade, whereas Synfig only allows one path per shape. Fixing it will probably require some mathematical calculations to determine how everything should work.

The parser at the moment is a self-contained module, the code can be found here. If you have any questions, I’ll be happy to answer them.

Adding one more case for SVG import problems… When I import the file, it seems all the points of imported vectors are at position x=0, y=0 and there’s no shape to be seen.

Could somebody help to diagnose my problem and give me some hints what can I do to make the import happen. I’m okay to fix my SVG manually if needed and I can repaint my stuff in Synfig, I just need my curves. I may even debug Synfig if really needed…

I’m using Synfig 0.63 and Inkscape 0.48 on Ubuntu 10.10. Exported SVG as plain SVG. I have no particular knowledge of SVG or vector graphics formats.

I attached the file itself and the XML from SVG file. Thanks for your kind replies! :stuck_out_tongue:

[code]<?xml version="1.0" encoding="UTF-8" standalone="no"?>




rdf:RDF
<cc:Work
rdf:about="">
dc:formatimage/svg+xml</dc:format>
<dc:type
rdf:resource=“http://purl.org/dc/dcmitype/StillImage” />
dc:title</dc:title>
</cc:Work>
</rdf:RDF>









[/code]
estobuntu.svg

There are known issues with latest 0.63.00 version of Synfig Studio and SVG import in Ubuntu. Weirdly it doesn’t happen with Fedora. I don’t have had time to debug it and have not initial idea why it doesn’t work in ubuntu and it works in Fedora. We will try to look at it as soon as possible. Meanwhile, Synfig Studio 0.62.02 will import correctly.

Sorry for the inconvenience.
-G

Thanks for the reply. Actually, reading messages about that on the forum yesterday, I also tried 0.62.02 and it didn’t seem to make a difference. I didn’t test it so extensively as 0.63.00 though. If you have a suggestion how can I help to debug this issue, maybe I can help to find out what’s the problem on Ubuntu.

I have imported a simple circle and it imports deformed. I’ve run the debugger to know what values from the svg file is worngly interpreted but it is not a simple task. Importing module uses recursion extensively so it is difficult to know where you are. I think that the problem comes from the conversion from a string to a float due to some change on the libraries used.

Also it is a known issue that import for the first time give bad results but delete and import it again gets the correct result (I’m talking on 0.62.02 because 0.63.00 doesn’t respond to that schema).

I’m a bit lost because I don’t know if it is a library issue or a code issue, since it doesn’t happen on Fedora with the same Synfig version. :frowning:
The fact it that 0.62.02 works “like expected” in ubuntu and 0.63.00 doesn’t.

Thanks for your offer for debugging in any case.
-G

Thanks, importing two times in 0.62.02 basically did it, I had to fix minor coloring stuff. I also updated corresponding wiki page. I’ll see if I have time to debug the code.

Hi boamaod. I’d like to help you with the SVG importer problems, but I don’t have my development computer with me on vacation so I can’t do any debugging. If you can debug the code, that would of course be great.

But for me, it’s come to the point where I can’t maintain the importer in its current state. (The main difficulty being that there is not any SVG library involved, so a lot of code must be written from scratch). I’ve decided to rewrite it as an Inkscape SIF exporter extension instead, so I can reuse some of Inkscape’s SVG-related code and make the job easier. I think this is the right decision in terms of making a converter that supports more SVG features and has less bugs. The code I’ve written so far seems to be working fine, and I was planning to finish it up and release it once I get back from vacation in early August. If any of you are really interested, I can post an alpha version earlier. (No quality guarantees - I’m running outdated versions of Inkscape and Synfig).

~Nikita

Hey Nikita,
good to know that you’re welcome back on coding. Sincerely I am not ready right now to face the SVG import problems we are having. Good luck with the Inkscape export module.
-G

Hello there,

The “SIF exporter extension for Inkscape” (svg2sif) created by Nikita work like a charm (for me at least)!

I think that this is THE solution for ubuntu (10.4 and others debian???) users who was frustrated of the regression of svg import between 0.62 (from the ubuntu rep") and the 0.63.05 from the .deb provide by synfig.org.

Can be found here :
Synfig.org Scripts & Tools : synfig.org/cms/en/download/tools/
Homepage: github.com/nikitakit/svg2sif

Nikita , , , , Thank(s for the work!!!

-----------------------config---------
Inkscape 0.47 / SynfigStudio 0.63.05 / Ubuntu 10.4

Nota : The direct svg import in synfig generate interesting result for contemporary art :wink:

:laughing:

-G

using win 7, Synfig Studio 0.63.05, Inkscape 0.48
Everything works on most of my inkscape sketches but I tried to export the following to add some bg foo. I believe the file may need bitmap trace or somesuch thing, but though I’d report it.
I get the following error:

Traceback (most recent call last):

File “synfig_output.py”, line 1344, in

e.affect(output=False)

File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect

self.effect()

File “synfig_output.py”, line 1053, in effect

SynfigPrep.effect(self)

File “C:\Program Files (x86)\Inkscape\share\extensions\synfig_prepare.py”, line 484, in effect

propagate_attribs(self.document.getroot())

File “C:\Program Files (x86)\Inkscape\share\extensions\synfig_prepare.py”, line 432, in propagate_attribs

propagate_attribs(c, this_style, this_transform)

File “C:\Program Files (x86)\Inkscape\share\extensions\synfig_prepare.py”, line 440, in propagate_attribs

node.set("style", simplestyle.formatStyle(this_style))

File “lxml.etree.pyx”, line 1355, in lxml.etree.__ContentOnlyElement.set (src/lxml/lxml.etree.c:37245)

File “lxml.etree.pyx”, line 1351, in lxml.etree.__ContentOnlyElement._raiseImmutable (src/lxml/lxml.etree.c:37169)

TypeError: this element does not have children or attributes
blue-wave.svg