bitmap files get Opened into layer 'root'

Bug #394503 reported by Alvin Penner
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Mc

Bug Description

- start Inkscape with an empty page, note that the default layer is 'Layer 1'
- perform File->Open on a .JPG file, note that 'Layer 1' is destroyed and the .jpg is loaded into layer '(root)'. This by itself might not be a major problem, except that all subsequent drawing now also occurs in layer '(root)' as well, since Layer 1 is destroyed.
- the same behaviour occurs when opening .GIF or .PNG
- this behaviour does not occur when using File->Import on .JPG or .PNG or .GIF. In this case the original layer, 'Layer 1', is retained.
- this behaviour does not occur when opening .PDF or .PS. In this case a new layer is defined, not '(root)'.
- this behaviour occurs in Inkscape 0.46 as well.

Revision history for this message
jazzynico (jazzynico) wrote :

I confirm this behavior, but I'm not sure it's a bug.
AFAIK, importing means adding the content of a file to the current document. That's what happens when we use File>Import AND when we open a PDF or PS (via an import dialog). But when we open a bitmap, it isn't added to the current document but opened in a new one. That's the reason why there's only a root layer.

Revision history for this message
Alvin Penner (apenner) wrote :

there are four cases that can occur:
1. Import a pdf/ps file : result is the image goes into the existing layer
2. Import a bitmap file : result is the image goes into the existing layer

3. Open a pdf/ps file onto a empty canvas :
 - result is a new layer is created with the name of the image filename
 - for the .ps file this layer name is somewhat garbled because it is the name of a temporary .pdf file created in a two-step process.
4. Open a bitmap file onto a empty canvas :
 - result is the image goes into 'root', which is not a layer at all.

In all four cases there is no new instance of Inkscape created because the images are going into a blank unused canvas.

I believe case 4 was probably intended to behave the same as case 3. The point is that under no circumstances should the user be encouraged to, or even allowed to, draw directly into the 'root' because this leads to a document structure that is inconsistent with 'normal' Inkscape convention. In case 4 the user has to manually create his own layer in order to avoid having his future work go into the 'root'.

Revision history for this message
Pablo Trabajos (pajarico) wrote :

The three first examples are expected, correct behaviour. The fourth, not so sure.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Pablo Trabajos (pajarico) wrote :

> In case 4 the user has to manually create his own layer in order to avoid having his future work go into the 'root'.
I tried opening a PNG and it doesn't let me create a new layer. If I make changes and hit save, a correct PNG is saved.

Revision history for this message
su_v (suv-lp) wrote :

> I tried opening a PNG and it doesn't let me create a new layer.
not reproduced: opened bitmap, 'Layer > Add layer…' works as expected. (Inkscape r22288)

>If I make changes and hit save, a correct PNG is saved.
Did you try to open the saved PNG? AFAIK Inkscape can only export not save as PNG - when saved it overwrites the bitmap with SVG content, and crashes on reopening (self-referencing when loading the linked PNG?). That's bug #429529

Revision history for this message
Pablo Trabajos (pajarico) wrote :

> not reproduced: opened bitmap, 'Layer > Add layer…' works as expected. (Inkscape r22288)
I swear it happened to me, but I can't reproduce it anymore.

> Did you try to open the saved PNG? AFAIK Inkscape can only export not save as PNG - when saved it overwrites the bitmap with SVG content, and crashes on reopening (self-referencing when loading the linked PNG?). That's bug #429529
I knew there was a bug! thanks suv ;) In pre2 it doesn't work that way: the PNG gets correctly overwritten. The resulting bitmap can be opened by Inkscape and Windows preview.

Revision history for this message
Pablo Trabajos (pajarico) wrote :

Addendum: once i created the layer, I can't undo it. I guess its OK since a document without layers seems to go against the norm.

Revision history for this message
Alvin Penner (apenner) wrote :

    I think the issue is that the behaviour of a File->Open on a blank sheet for a .jpg, .gif, or .png is not consistent with the behaviour on a .pdf file. When opening a pdf file, the original layer is replaced by a new layer with a new name and the document structure is not altered by this process.
    When opening a bitmap file like png the original layer is destroyed and the 'root' is exposed, which would otherwise never happen under ordinary circumstances.

tags: added: bitmap import-export layers
jazzynico (jazzynico)
tags: added: importing
removed: import-export
jazzynico (jazzynico)
Changed in inkscape:
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
Beluga (buovjaga) wrote :

Still repro.

Win 7 64-bit
Inkscape 0.92pre1_64bit r15044

Revision history for this message
Mc (mc...) wrote :

proposed patch

Revision history for this message
Mc (mc...) wrote :

pushed in 15119

Changed in inkscape:
assignee: nobody → Mc (mc...)
status: Triaged → Fix Committed
Changed in inkscape:
milestone: none → 1.0
Max Gaukler (mgmax)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.