Gimp: Export every layer as a separate PNG image

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.


Solution 1:

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
    
    $ # note, later version of file-roller on ubuntu hard-code file suffixes, 
      # and refuse to open ".ora" files, work around by renaming the file to ".zip"
    $ ln -s myfile.ora myfile.ora.zip
    $ file-roller myfile.ora.zip
    

    alternatively

    $ unzip myfile.ora
    

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

Solution 2:

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.