Batch process for multiple aseprite files


#1

Hello,

As the title says, I’m trying to batch process multiple aseprite files flexibly in one go.

I’m wondering if its possible to achieve a batching system which allows for the following:

. Have Aseprite be located in a folder of its own.
. In a separate asset folder, have .aseprite files.
. Have a Batch File that can be run from anywhere.
. Have said batch file create .png files with the same name as the .aseprite file for all .aseprite files in the same asset folder (e.g. Walk.aseprite creating Walk1.png, Walk2.png etc. and Stand.aseprite creating Stand1.png, Stand2.png etc.)
. Being able to edit the batch file in a manner such that only changing the directory of the asset folder was required.

This way, you’d have a folder for character A and B, and you’d run the batch file once for each character to allow for .pngs of their animations.

I looked around and thought the following might work (credit to dacap for original code):

aseprite="G:\Desktop\Aseprite\aseprite.exe"
for file in G:\Desktop\Char_A\*.aseprite ; do
  "$aseprite" -b $file --save-as *.png
done

However, nothing happens when the batch file is run.

I understand Aseprite does not have a batch processing feature at the moment, but is there a way to do this with a Batch File?

Thanks in advance!


#2

First of all you need Bash for Windows to run the .sh file, and then you can use a script like this:

aseprite="G:\Desktop\Aseprite\aseprite.exe"
for file in G:\Desktop\Char_A\*.aseprite ; do
  "$aseprite" -b $file --save-as ${file%.aseprite}.png
done

#3

Thank you dacap for the input.

I tried your suggestion, but unfortunately it didn’t work. I’ve made the names and directories all correct. In Git Bash, I copied and pasted the full script, but for some reason, the syntax gets messed up. So I copy pasted each line one by one then tried again. This gave me an error message: bash: syntax error near unexpected token 'do’

Typing out the code in a single line also yields the same result.

Obviously I’m doing something wrong. Also, something to consider. I assumed executing a bat file in the directory where the aseprite files were located would automatically create the .png files in the same folder. Not sure if this is valid or not, but if Git Bash is being used, would the output directory not be an important consideration in the script?

I’ve never used Git Base before so your patience is appreciated.

Thanks again.