Page 1 of 1

Extracting layers from a Gimp XCF file to PNGs

Posted: 2012-10-18T02:07:10-07:00
by rossmcm
IM is great for batch-file based generation of composite images, but my "source" images are all produced with Gimp. If I make a tweak to one of the source images using Gimp, I need to export that image and then run the batch file again. This is one manual step in what is otherwise completely automatic.

There is a command-line utility called XCF2PNG which extracts layers from an XCF file to a PNG file, but it would seem this is only available for *nix. However, I see that XCF is listed as one of the supported filetypes in IM.

How would I go about extracting a layer (and transparency channel) with a particular name and saving it as a PNG file?

Thanks.
R

Re: Extracting layers from a Gimp XCF file to PNGs

Posted: 2012-10-18T09:48:54-07:00
by fmw42
Normally in IM, layers are extracted using [ ] notation at the end of the filename. This is used for frames, layers and pages of different image formats. For example

convert image.xcf[2] image2.png would extract only layer 2 (numbering starting with 0) and write it to image2.png

Extracting the alpha channel (if alpha and not background transparency) is done by

convert image.xcf -alpha extract image_alpha.png

Generally IM 6 does not know how to deal with background transparency coming from PSD, TIFF. I am not sure if that is an option in XCF.


see selecting frames at
http://www.imagemagick.org/script/comma ... essing.php

http://www.imagemagick.org/Usage/basics/#list_ops
http://www.imagemagick.org/Usage/masking/#alpha_extract