Skip to content

Instantly share code, notes, and snippets.

@marcusmoller
Last active November 17, 2019 15:58
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save marcusmoller/6622766 to your computer and use it in GitHub Desktop.
Save marcusmoller/6622766 to your computer and use it in GitHub Desktop.
A small sprite combiner written in shell. Used on: http://opengameart.org/content/700-sprites
#!/bin/sh
for f in *.gif
do
short=${f:0:4}
if ls $short".png" &> /dev/null; then
echo "file exists"
else
montage -tile x1 -geometry +0+0 -background none $short*.gif $short.png
convert $short.png -transparent white $short.png
fi
done
@kenkendk
Copy link

You can take it one step further and build it into a single texture (using the 256x32 pngs):
montage -tile 4x -geometry +0+0 -background none *.png ../lastguardian-all.png

That will create a 1024x736 png with all the sprites. I put up a copy here:
http://postimg.org/image/mqncja9q9/

Remember to credit him:
... Philipp Lenssen and my website is outer-court.com . An appropriate link to the site and credit by name would be appreciated in your projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment