Save layers as separate images with Gimp

Gimp is the ‘Photoshop’ for indie game creators. It’s free,simple to use and it’s…. free. What is really missing in Gimp is a way to save all layers as a separate image file. This is very useful if you want to create a sprite sheet of your sprites, a character set, or an animation. With texturepacker you can create a spritesheet.

Luckily there is a plugin that can do that for you. Follow the following steps to install this plugin :

  1. Download the Save all Layer script here or here.
  2. Store the script in the folder /Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts
  3. Restart Gimp

Screen Shot 2013-04-01 at 1.15.03 PM

You should see this extra option if the file menu is opened. When you have created some layers and try to export this, this export menu will popup.

Export options

For this example I created two layers with a one and two digit. When you export these layers with Save All Layers you need to provide a path and a prefix. The downside of this plugin is that the order of layers is reversed. Digit 2 will be digits1 and digit 2 will be digit 2.

Luckily there is a way to reverse the order of the layers. This can be done with layer >> stack >> reverse layer order.

Reverse layer order

The layers now have the correct order when exported. It’s ready for Texturepacker or Zwoptex.


8 comments

    • Yes, just decided to give this script a chance on Gimp2.8 on LinuxMint and it worked like a charm – years after it was written it seems that this is still kicking strong. Good script Saul!

  1. Hey, I have a problem when it tries to save the first layer. It says it couldn’t open the file for writing “permission denied” I’m on a Mac. Do you know how to set up permissions?

    • I believe this can only happen when you don’t have permissions to write to the folder you specified.
      You should have permissions somewhere as a mac user, probably /Users/[your username]/[a folder you can access like ‘Documents’]. Try that and see if it’s fixed.

  2. Just used this script. It works and it’s usefull.
    Beware, though, it has some quirks:
    It didn’t ask where to save the files, just threw them all where the original gimp file was.
    For folders containing layers, it made a single image with all its layers merged (it maybe predates layer folders in gimp?).
    And there’s that thing about reversing layer order mentioned in the article (I used it with layer names).
    Not perfect, not a lot of options, but indeed a very nice one to have.
    Thanks for the post!

  3. On Mac, Mavericks OS
    Error while executing sg-save-all-layers:

    Error: ( : 2) Procedure execution of gimp-file-save failed: Could not open ‘frame_0001.png’ for writing: Permission denied

    • Sorry Wrong paste
      Error while executing sg-save-all-layers:

      Error: ( : 2) Procedure execution of gimp-file-save failed: Unknown file type

      Let me know

      • Did you choose a graphics file format, like .png or .jpg?
        In the name template I have for example /Users/franzzle/Pictures/heli_~~.png where the number of ~ is the maximum amount of layers you have in you gimp file. This makes heli_01.png, heli_02.png etc…


Leave a comment