I have an Aseprite file with a bunch of different animated separated with tags in it. I want to export each tag as a separate png spritesheet. However, I can only seem to make it export as a single spritesheet with each tag separated on a new row, which isn’t what I want.
I found something that sounded promising, putting “{tag}” in the filename to get this result - but this doesn’t appear to work in 1.2.20.
Having an export option for file naming similar to the JSON one would be phenomenal (in fact I had mistakenly assumed that the “Item Filename” input referred to the output file the first time I used it)!
P.S: I don’t think this is currently possible – I tried many variations of aseprite -b original.aseprite --split-tags --sheet-type horizontal --sheet Sheet.png --save-as {tag}.png, but instead of the expected {tag}.png spritesheet, the frames are saved separately as {tag}{frame1}.png.
Same issue here, --split-tags will either export to .gif or isolate frames which means you mean yet another command to concatenate the GIF frames or isolated frame files into a spritesheet.
–split-tags --sheet output_sheet.png (without customising --sheet-type) will export all tags as spritesheets one by one, one row per tag/animation. This is great in some spritesheet import workflows but in this particular case I need one spritesheet per animation.
(and --save-as outputA.png combined with --sheet outputB.png will just do the usual export individual frames to outputA[N].png before exporting sheet, but it’s a separate operation and doesn’t affect the spritesheet output)
OK, I wrote a bash script to first export to GIF then re-export them to png spritesheets (using aseprite each time).
It would be even better as an Aseprite script (so we have a command, can bind a shortcut to it and possibly even a popup window so user can set custom parameters) but I need to have a look at the Lua API.
Note that it creates a temporary “temp” sub-folder to do the job.
#!/usr/bin/env bash
# Posted on https://community.aseprite.org/t/how-can-i-export-multiple-spritesheets-at-once/6165
# Consider porting this to Aseprite Lua API for an integrated menu command
usage() {
echo "Usage: export_spritesheets_from_aseprite_tags.sh aseprite_filepath
Export all tagged animations in .aseprite file to spritesheets, one spritesheet per tag, to some Export sub-folder,
using the format '[file_basename]_[tag]_spritesheet.png'
Requirements:
- asprite installed and binary in PATH
ARGUMENTS
aseprite_filepath Path to aseprite file containing the tagged animations, including extension
"
}
if ! [[ $# -eq 1 ]]; then
echo "Wrong number of positional arguments: found $#, expected 1."
echo "Passed positional arguments: $@"
usage
exit 1
fi
aseprite_filepath="$1"
shift 1
# Ex: "character"
file_basename=${aseprite_filepath%.*}
# Setup temp dir
rm -rf temp
mkdir -p temp
# 1. Export separate gifs
# Ex: export "Export/character_idle.gif" and "Export/character_attack.gif"
aseprite -b "$aseprite_filepath" --save-as "temp/${file_basename}_{tag}.gif"
# 2. Convert each gif in temp folder to a png spritesheet
pushd temp > /dev/null
for gif_filepath in *.gif; do
# Ex: "character_idle"
animation_file_basename=${gif_filepath%.*}
# Mute spritesheet metadata json output
# If you need it, you can add --data "${animation_file_basename}_spritesheet.json" instead
aseprite -b "$gif_filepath" --sheet "${animation_file_basename}_spritesheet.png" > /dev/null
done
popd > /dev/null
# 3. Move all spritesheets to Export folder
mkdir -p Export
mv temp/*.png Export/
# Clean up temp dir
rm -rf temp