Skip to content

Instantly share code, notes, and snippets.

@johannilsson
Created October 18, 2013 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johannilsson/7037732 to your computer and use it in GitHub Desktop.
Save johannilsson/7037732 to your computer and use it in GitHub Desktop.
Make a sprite & a debug sprite of a set of png image.
#!/bin/sh
echo Creating output.
rm -rfv out
mkdir -vp out
echo Making tiled version.
montage *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out.png
echo Making tiled debug version
montage -label '%t\n%[width]x%[height]' -font 'Arial' *.png -tile x1 -geometry '1x1+0+0<' -alpha On -background transparent -quality 100 out/out-debug.png
echo Running optipng
optipng out/out.png -out out/out-opt.png
optipng out/out-debug.png -out out/out-debug-opt.png
# Get tile dimensions
FILE=`ls | grep -m1 png`
FILE_DATA=`identify $FILE`
DIMENSTION=`echo $FILE_DATA | cut -d" " -f3`
WIDTH=`echo $DIMENSTION | cut -dx -f1`
HEIGHT=`echo $DIMENSTION | cut -dx -f2`
echo w: $WIDTH, h: $HEIGHT
FRAMES=`ls *.png | wc -l`
echo $FRAMES Frames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment