56

I have come to a situation where I have an image in Gimp with multiple layers. Now, I want to export every single layer as an individual image (PNG format preferably) automatically to a folder somewhere.

Is this possible?

The long method: Hide all layers except one, crop the section you want, export image. Hide saved layer, unhide another one, crop section, export. Repeat. Kinda cumbersome for an image with about 20 layers.

  • Parto please consider accepting the answer by @ThorSummoner askubuntu.com/a/749561/453746 as it seems to be a much better solution for new people finding this answer today without installing a plugin. – Jeff Puckett Sep 28 at 4:23
41

You may try also this plugin, Export Layers. I've tested it with png format and it worked. You just select the folder and the format and you get all the layers there, each one in its own file.

  • 2
    This was the easiest. Extract the file, copy the .py file to your ~/.gimp-2.8/plug-ins folder, make it executable, restart GIMP. – Parto Jun 20 '14 at 12:27
  • Doesn't work in GIMP 2.6 btw. – installero Sep 6 '14 at 10:44
  • 2
    This is also availabe at GitHub: github.com/khalim19/gimp-plugin-export-layers – moi Aug 24 '16 at 8:30
  • the installation instructions for this plugin are stupid. :P Just install please, I don't care about directories. – ether_joe Jul 21 '18 at 18:17
  • Agreed that the installed (for linux) is rough; this is the command I needed to use to make it work with an AppImage GIMP install: ./export_layers-3.2.1-linux.run --target /home/myname/.config/GIMP-AppImage/2.10/plug-ins/ -- -g /path/to/gimp-git-2.10.5-20180719.glibc2.15-x86_64.AppImage -i /home/myname/.config/GIMP-AppImage/2.10/plug-ins/ – user272901 Aug 21 '18 at 5:13
79

If PNG is an acceptable output format, one option is to export it as Open Raster (.ora), an open specification for layered-image files.

  1. Export Image as Open Raster (.ora)

    File -> Export As ...

    myfile.ora

  2. Open myfile.ora as an archive, with a program like file-roller or 7zip.

    On Ubuntu:

    $ file-roller myfile.ora
    

    (alternatively)

    $ unzip myfile.ora
    

    All your layers will be png images under /data, Extract them and use at will.

  • 8
    this was awesome, thanks- I think this is the best solution. Nothing to install and very fast. I just did it with GIMP with a PSD. – LowFieldTheory Oct 11 '16 at 13:11
  • 1
    This exported a flattened image for me :( – Petah Nov 20 '16 at 21:59
  • Excellent way to do this! Thanks. Works fine in Gimp 2.8.20. – VIK Jun 11 '17 at 15:06
  • 1
    Looks like ORA support was dropped in 2.10. :( – spacer GIF Aug 1 at 20:10
  • 1
    @michael yikes, I'd guess the metadata is there in the ora somewhere, might be easy thing to script, at that rate I'm not sure why or what it takes to write a gimp export extension to do the right thing the first place – ThorSummoner Aug 26 at 1:26
6

One could export the image as an animated GIF. This will save each layer as a separate frame in the GIF. Then, the imagemagik command convert -coalesce ./myfile.gif outfile%05d.png will extract the frames as PNG images.

  • 3
    Note: GIFs only support 256 colour palettes, so it would not be possible to do 24-bit PNGs this way. – thomasrutter Mar 24 '16 at 5:34
  • Furthermore, for large images convert takes ages while unziping an ORA file is almost instant. Good idea, though. – Skippy le Grand Gourou Dec 16 '18 at 21:27
6

Certainly, this work for the plugin Export Layers to File.

Features:

  • Manipulate the layers in layer group.
  • Export texts, patterns and layer filters.
  • Prefix name for the image files has to be given.
  • Export only in jpg, png, bmp formats but the required formats can be added easily.
3

I think you can try to find something with ImageMagick : apt-get install imagemagick. It seems to be able to handle XCF format and you can export a layer in png using a [N] in the command, where N is the level of your layer.

Source : http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=17603

ImageMagick Read Mods : http://www.imagemagick.org/Usage/files/#read_mods

2

First of all you don't need any plugin. Even you don't need to crop anything. Few simple steps.

  1. Select a layer. To do that just click on that particular layer.
  2. Copy the layer to a clipboard using Ctrl+C
  3. Now create new image using Ctrl+Shift+V

That's it. Now you can simply export that layer to any format.

  1. Use Shift+Ctrl+E
  • If you only wanted specific layers, then this is the better way to go... – Murshid Ahmed Jul 10 at 18:20
1

I was doing the same thing and trying to download the plugins mentioned in the answers. As the Gimp website is currently down, I could not get the plugins and I had to find another solution.

What I ended up doing was use the screenshot software Shutter, which allows you to select a region of the screen and then you can repeat the same screenshot of that region with just 1 click. So it becomes a 2-click per layer operation: hide layer, screenshot, hide next layer, screenshot, ...

Much faster than anything else I could come up with, and takes less than a minute for 20 layers. You may lose image quality although in my case it was not a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.