[Script] Export sprite's layers separately

Introduction and description

I’m working on a game where characters are drawn in layers, so you can choose their clothes and complements. As I was making these sprites I started to miss a function to export all layers on a sprite as individual png images with their own name and on a specific folder. I couldn’t find this feature, so I investigated and found that there is an api for Aseprite, so I made my own script that does just that before making sure there was no way to do it other way.


NOTE.- This script should only work on Linux/GNU and Windows machines. Not tested on any other operative system, although it should work on Mac OS as well.
NOTE 2.- No hard testing went into this script. It should work fine, but use at your own risk. I’m not responsible of any bad use of the script nor unexpected behavior of it.

To execute the script just run it (File → Scripts → Export Layers) and all layers will be exported to their respective png file. If your sprite has multiple frames, all layers for all frames will be exported with their frame index at the end of the file name.

The images are saved on a new folder where the original file is located. I saw on the github repository issues that there is a function to ask the user for a directory on the go, so this is a temporary location until that function is added.


You can download the latest version from here.


To install a script, copy the .lua file into Aseprite’s script path (you can find it in File → Scripts → Open Scripts Folder) . Then, if Aseprite was open, rescan the scripts folder (F5 by default or File → Scripts → Rescan Scripts Folder) or simply restart Aseprite.
For a detailed guide on scripts, check out @JJHaggar’s collection, as it includes a detailed guide on how to install and use scripts as well as a bunch of them!


  • v1.3 - Fixed layers in groups not exporting after API v1.2.14 changes.
  • v1.2 - Improved file name with sprites with multiple frames.
  • v1.1 - Added Windows support and an error message if no sprite is currently active.
  • v1.0 - Initial release.

I hope you find this script useful and thank you very much for using my script!
Any comment, feedback or suggestion is appreciated!


Hi @Gaspi, thanks for sharing and welcome to Aseprite community! :smiley:

I’ve added this script to the list of scripts I’m collecting here , I hope you don’t mind :slight_smile:

Is there any possibility that you add support for Windows to the script? (maybe asking about the OS in the code to choose one way of using paths or another? I’m a bit noob so I’m not sure if that can be done easily in lua).


Hi, @JJHaggar!

Thank you very much for the wellcome! I updated the script and it now works both on Linux and Windows. The way I did os recognition is not the best but it should be fine.

Have a nice day!


That’s great, thank you very much! :smiley:

1 Like

you rock :heart:


great tool! It’s almost exactly what I was looking for. Say would it be difficult to modify the script to save frames from each layer in a separate folder and have the folder named after the layer?


this is awesome!! thank you so much


Thank you so much!

You are my favorite person today. :3 Thank you so much!

1 Like