Only 2 layers from Gimp XCF

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Only 2 layers from Gimp XCF

Post by snibgo »

IM can only see the bottom two layers from a Gimp XCF file.

For example, I have created http://www.snibgo.org/images/gimplayers.xcf in Gimp 2.6.8. A screenshot of Gimp looks like this:

Image

identify gimplayers.xcf

gimplayers.xcf[0] XCF 320x200 320x200+0+0 8-bit DirectClass 21.5KB 0.016u 0:00.016
gimplayers.xcf[1] XCF 320x200 320x200+0+0 8-bit DirectClass 0.016u 0:00.016

"Convert" is consistent with 2-layers-only:

convert gimplayers.xcf -layers flatten glflat.png

Image

This is on Windows7, IM 6.6.2-4. Earlier versions of IM show the same behaviour.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Only 2 layers from Gimp XCF

Post by magick »

It may be some time before we fix the XCF problem. We currently do not have a maintainer for the XCF image format.
GoblinWorkshopGames
Posts: 2
Joined: 2011-06-06T14:21:43-07:00
Authentication code: 8675308

Re: Only 2 layers from Gimp XCF

Post by GoblinWorkshopGames »

I'm confirming the same issue. I'm not sure if xcfinfo or xcf2png will work better, since I'm a noob and still trying to get GIMP installed on my VPS. :) One problem at a time, I suppose...

Anthony Gill
efAston
Posts: 3
Joined: 2011-07-23T11:32:38-07:00
Authentication code: 8675308

Re: Only 2 layers from Gimp XCF

Post by efAston »

Yes I've had the same problem. It's a shame, because I've been using GIMP to modify PDF's, and to convert the modified documents back to PDF, I first need to output all the layers to separate images (which requires a plugin).

http://kubuntuforums.net/forums/index.php?topic=3117706

I tried saving files to PSD to see if that solved the problem, what happened was I got a PDF which had one page for each layer (correct), except the bottom layer was repeated as a final page in the PDF (so a four layer PSD is output to a PDF which reads Page 1, Page 2, Page 3, Page 4, Page 1).

It did however, work perfectly when I saved to an animated GIF and converted from that :D. Of course GIF has colour restrictions, but saving to MNG solves that problem. That actually solves my issue.
Last edited by efAston on 2011-07-23T12:06:30-07:00, edited 3 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Only 2 layers from Gimp XCF

Post by fmw42 »

In GIMP, save your files as psd. That seems to be the only one of the GIMP export formats that will handle both transparency and layers. (GIMP is kind of "gimpy" with respect to dealing with transparency and layers in saving to other output formats). Then IM can process that, though you will get an extra first [0] layer that is the flattened image, but the remaining four layers are there after that, with respect to the first example provided by snibgo.
efAston
Posts: 3
Joined: 2011-07-23T11:32:38-07:00
Authentication code: 8675308

Re: Only 2 layers from Gimp XCF

Post by efAston »

That would be cool if you could exclude layer 0 with a switch, as having that in the mix is enough of a hassle to add an extra step.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Only 2 layers from Gimp XCF

Post by fmw42 »

IM can filter out any layers you want. For example, in GIMP, first save your files as psd, then

convert gimplayers.psd[1-4] gimplayers1to4.psd

convert gimplayers1to4.psd -scene 1 gimplayers1to4_%d.png
gimplayers1to4_1.png
gimplayers1to4_2.png
gimplayers1to4_3.png
gimplayers1to4_4.png


or save it to some other format that supports both layers and transparency, such as tif, or IM's miff

convert gimplayers.psd[1-4] gimplayers1to4.tif

convert gimplayers1to4.tif -scene 1 gimplayers1to4_%d.png
gimplayers1to4_1.png
gimplayers1to4_2.png
gimplayers1to4_3.png
gimplayers1to4_4.png

see
http://www.imagemagick.org/Usage/files/#read_mods
http://www.imagemagick.org/Usage/files/#scene
Last edited by fmw42 on 2011-07-23T18:07:25-07:00, edited 3 times in total.
GoblinWorkshopGames
Posts: 2
Joined: 2011-06-06T14:21:43-07:00
Authentication code: 8675308

Re: Only 2 layers from Gimp XCF

Post by GoblinWorkshopGames »

Thanks Fred - I think this gets me unstuck! I appreciate the reply. :)
efAston
Posts: 3
Joined: 2011-07-23T11:32:38-07:00
Authentication code: 8675308

Re: Only 2 layers from Gimp XCF

Post by efAston »

Yeah that's really handy information, cheers from me too :).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Only 2 layers from Gimp XCF

Post by fmw42 »

It is too bad that GIMP does not support multilayer transparent files other than PSD, not even TIF.

Hopefully one day, some kind knowledgeable programmer will be able to contribute to helping make IM more compatible with GIMP's XCF image format.
Post Reply