How to export all ".aseprite" files in a folder?

How could I export only the visible layers of all “.aseprite” files in a folder as “.png” using the same file name?

For example:
file_a_1.aseprite → file_a_1.png
file_a_2.aseprite → file_a_2.png

Hi @phartz,

If you want to take a Lua script approach, much of what you need will be in app.fs. This includes methods to list all the files in a directory and to break a file string down into its path, title and extension. After that, both Sprites and Images can be loaded from a filename. Both have save methods.

I take you to mean you want to export all layers in a sprite flattened down to one image (not each layer as a separate image). I’d expect hidden layers to be excluded from a save to png by default. If you wanted to make sure, though, there’s the FlattenLayers command, which has a visibleOnly flag.

I’m guessing there’s a CLI approach as well, but I’m not as familiar with that, so look at the linked docs if you’re interested.

Jeremy

Adding this in case it’s helpful to someone.

As Jeremy hinted, you could use a simple batch script (that uses the cli) to accomplish this (this might export non-visible layers; I haven’t tested that). Save and run this bash script inside the folder with all the .aseprite files. This will export all .aseprite files in the folder as .png files.

#!/bin/bash
for file in *.aseprite; do 
    aseprite -b "$file" --save-as "${file%.*}.png"
done