jkrumbiegel / Layered.jl

MIT License
9 stars 2 forks source link

exported .svg file is not editable #3

Open goszlanyi opened 4 years ago

goszlanyi commented 4 years ago

@jkrumbiegel First of all, thank you very much for making this package available. Maybe it is too early to report any issues or ask any questions, but here is one.

I have exported some examples (with or without multiple layers) in .svg format, imported them into Inkscape, did the ungrouping step, but unfortunately I could not edit the components, except from removing the background.

Maybe Inkscape is not good at ungrouping, but what could be done about it? I am asking this, because postprocessing a figure is often very useful or even inevitable.

jkrumbiegel commented 4 years ago

Hi, glad that you're interested in the package. I've just started noticing things like this as well, when opening images in illustrator. I don't have my own svg engine here, it's just Cairo.jl in the background that is doing all drawing. I think that drawing operators other than :over are not supported in svg so the image gets flattened to a bitmap before those layers are added. That could be the case for you. The other thing is that Cairo's layer functionality (push and pop group) creates a much "messier" svg structure than illustrator does. I think the only remedy would be to take control of the svg export, but that could get very complex.. Maybe I could use Compose.jl but I'm not sure if they support all the features regarding clipping etc

goszlanyi commented 4 years ago

Thank you for your prompt answer. I did not know that exporting .svg files is so complex. But today I also noticed that importing the same .svg files also differ, e.g. Vectr online can separate the components that Inkscape could not.

jkrumbiegel commented 4 years ago

Maybe it's not so complicated after all to write my own little svg output engine, at least the output I get from illustrator doesn't appear to be so complex. That would be highly beneficial to not rely on Cairo and I could probably do optimizations as well with markers and glyphs etc that Cairo doesn't do. I'll see if I have time at some point