How do I save layers?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
BlueKnight
Posts: 53
Joined: Sat Jun 16, 2012 10:37 pm

How do I save layers?

Postby BlueKnight » Sat Jun 16, 2012 10:59 pm

Hi! I am using inkscape on linux and when I save in any of these formats: Inkscape SVG, Default SVG, Compressed Inkscape SVG, Compressed Default SVG, and tried almost all other formats, but I believe these are the most common.

But when I save, all the layers created in file do not exist anymore (waste of time) when opened by inkscape later (when I close inkscape and want to resume the work by opening a new file).

Isn't it possible to save layers in file to resume work later with the layers still there? If it is not possible, I would recommend fixing this (if it is an error) or simply removing this function since it is almost useless.

I also want to thank all the people who have worked hard in this amazing and free software. :D

Thank you!

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How do I save layers?

Postby brynn » Sun Jun 17, 2012 2:45 am

Image
Welcome to InkscapeForum!

Oh wow! No, that's not expected behavior at all. I'm not very familiar with the "Plain SVG" (which I'm guessing might be called Default SVG, perhaps in another language?) and I don't understand the difference between Plain and Inkscape SVG. But I know with Inkscape SVG, the layers should remain intact until you delete them. And I'm pretty sure that's the case with Plain SVG. I don't know, maybe the compressed SVG loses the layers in the compression process, but I honestly don't know.

Now, the Layers dialog will close, when you close the file. And when you open the file, you have to open the dialog again. But the layers should be still there. Besides the Layers dialog, there's a layer indicator, with a dropdown menu of the layers, at the bottom of the Inkscape window, just to the left of the status bar (kind of in the middle of the bottom). Even if you don't open the dialog, you should still see the layers there.

Often we will ask someone to provide an SVG file with the problematic content. But in this case, if layers are indeed being lost, I don't know if we could use an SVG file to investigate. It might be something a little "deeper". You said you're on a Linux machine, and what is your Inkscape version? Did you use an installer, or the 7z version? I guess I wouldn't be surprised about this, if you have a development version. The solution would be to either use a stable version, or at least a more stable development version.

Oh, well in this case, a couple of screenshots would probably work, at least to confirm the problem. Would you please do 2 screenshots of an SVG file which has at least 2 layers? Do 1 just after you save it, but before you close it. Make sure that either the Layers dialog is open, or the dropdown menu is displayed. Then close it, and then reopen it. Open the Layers dialog, or display the dropdown menu, and do the 2nd screenshot. I'm still not sure how to investigate the problem, but this will at least confirm it (or not).

{Info on screenshots, if you need it: viewtopic.php?f=6&t=11753}

User avatar
BlueKnight
Posts: 53
Joined: Sat Jun 16, 2012 10:37 pm

Re: How do I save layers?

Postby BlueKnight » Sun Jun 17, 2012 3:43 am

I discovered the problem. If I drag and drop it imports the file instead of opening.

When I go to "Menu > File > Open" it opens correctly with all layers.

Maybe because inkscape creates a new document when started and drag and drop will import instead of opening.

It is solved now. Thank you! :D

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: How do I save layers?

Postby ~suv » Sun Jun 17, 2012 6:56 am

BlueKnight wrote:Hi! I am using inkscape on linux and when I save in any of these formats: Inkscape SVG, Default SVG, Compressed Inkscape SVG, Compressed Default SVG, and tried almost all other formats, but I believe these are the most common.

There is no 'Default SVG' file format listed in Inkscape - it's called 'Plain SVG': this format strips all custom Inkscape attributes from the file (including the special attributes storing information about layers). If you want to edit a file with Inkscape later on, always save the original version as 'Inkscape SVG', and save additional copies in other formats as needed (e.g. when intending to publish an SVG on the web (-> 'Optimized SVG'), or sharing it with users of other vector editors able to open SVG files (-> 'Plain SVG')).

Note: whether choosing the 'compressed' variant or not does not matter in the context of your question (the difference is only whether the file is saved as text or in a binary (compressed) format - the actual content is the same).

BlueKnight wrote:But when I save, all the layers created in file do not exist anymore (waste of time) when opened by inkscape later (when I close inkscape and want to resume the work by opening a new file).

This only happens when saving the file as 'Plain SVG' or 'Optimized SVG' (with 'Keep editor data' unchecked), but not when saving as 'Inkscape SVG'.

Technically, layers in Inkscape are implemented using regular SVG <group> objects with additional special attributes which allow Inkscape to recognize and manage them as layers (this is due to missing native layer support in the current SVG specification). When saving as 'Plain SVG' (or as 'Optimized SVG', depending on the chosen options), these special attributes are removed. When opening such files later on in Inkscape, prior layers are now regular groups.

-> to keep layers, always save as 'Inkscape SVG' (compressed or not, doesn't matter).

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How do I save layers?

Postby brynn » Sun Jun 17, 2012 7:50 am

Oh, that's great, BlueKnight! I'm glad you sorted it out, because that was going to be tough to investigate, if it was actually happening, lol. (Well, tough for me, anyway :D)

Thanks for info, ~suv :D

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: How do I save layers?

Postby ~suv » Sun Jun 17, 2012 7:51 am

BlueKnight wrote:I discovered the problem. If I drag and drop it imports the file instead of opening.

When I go to "Menu > File > Open" it opens correctly with all layers.

Ah, ok - this is a known issue, tracked in Bug #502075 “Import Inkscape SVG loses layer and sub-layer information”.

(I'm a bit surprised that you assumed that when drag&dropping an SVG file into a document window Inkscape miraculously would be able to anticipate your intention (to actually open the dropped file in another document window instead of importing it - possibly along with others - into the currently open (new) document).

User avatar
shawnhcorey
Posts: 149
Joined: Mon Jan 07, 2008 12:17 pm

Re: How do I save layers?

Postby shawnhcorey » Sun Jun 17, 2012 10:49 pm

You should note that SVG does not have layers (not yet, anyway). Instead, Inkscape uses groups for layers so saving a SVG as Plain SVG will remove all information about layers. But the can be recreated if needed.


Return to “Help with using Inkscape”