GNOME Bugzilla – Bug 317044
Empty layers vanish from Photoshop files (PSD)
Last modified: 2008-01-15 13:00:46 UTC
Distribution/Version: Gimp.app Using Photoshop (I did this with 8.0 for OS X), save a PSD file with at least one empty layer (and any other content you like). Open it in GIMP, and the empty layer is not there. Going the other way is fine: empty layer in a PSD saved with GIMP is there when opened in Photoshop. Though if you then save the document in Photoshop, it will be gone again in GIMP.
What's your definition of an empty layer?
Create a layer containing transparency. Don't do anything else to it. In Photoshop, that's just Layer > New > Layer... and press OK. In GIMP, Layer > New Layer and leave fill type as transparency.
Can you please attach a small PSD file that shows the problem?
Created attachment 52575 [details] Testcase PSD file. Contains background + 2 layers: 'empty' and 'not empty' When I open this file in Photoshop, I see all three layers. In GIMP, the empty layer is missing.
Oops, bugzilla didn't like that. Changing the file extension of the attachment to PSD after downloading works fine (or rather, it doesn't, if you see what I mean ;)
The empty layer is of size 0x0. This is explicitly filtered out as "bad" by the fix for bug #122602, since in GIMP's layer paradigm, a 0-sized layer is nonsensical. Perhaps 0-sized layers from a PSD should be a fully transparent layer that has the same dimensions of the background layer. Thoughts on this?
Since PS seems to automatically extend layers while you draw on them, a newly created layer would have 0x0 pixels. We should create a transparent layer of image size.
Created attachment 59332 [details] [review] attempt at fixing the problem as discussed
I have committed this change to the HEAD branch in the hope that it will get some testing there. I am leaving this bug report open until we have decided if we want to merge this change into the stable branch or not.
I had a similar problem to this (did a quick search and I don't think I filed a specific bug for it at the time). I created a test PSD file with a bunch of named layers (each layer was named and colour coded using a highlight/labelling feature from Photoshop 7) but when i opened the file those layers had "disappeared" because just as in this bug the layers were empty, although I had gone to the trouble of naming all those layers. So the fix in this bug would help prevent the loss of named layers which haven't yet been painted on but certainly aren't useless. [Found my earlier comment which i think is related though the rest of the bug report is about a differnt issue: http://bugzilla.gnome.org/show_bug.cgi?id=142468#c16 "i had a test file with some (named but otherwise) empty "coloured layers" which disappeared".]
Does this test file load correctly now? I've tried some of the files that were attached to bug #122602, its dupes and other PSD-related reports in Bugzilla, and they seem to have more layers (empty + image size) now than compared to loading them in GIMP 2.2. So I guess that the fix works as intended.
It works here, I am closing this bug report.
Hey guys, the following problem. I have an image created with photoshop cs2 and it have 962 layers and most of them are empty. Since this patch applied, gimp is unable to open this image due to the lack of memory. Can this code be optimized to take less memory on empty layers?
Not easily.
Hm, I've gone though the code, it might be problem really. But there is no technical reason to avoid layers with 0 x 0 dimension. Sven, can you describe the steps that one should do to implement support for such layers? Probably we can just deny drawing on them, it will be easier than to extend layer after drawing as in PhotoShop.
This will become no problem when we have done the switch to GEGL as that should allow us to implement unbounded layers and also to special case empty layers. But this bug report is not the right place to discuss this.