Skip to content

Instantly share code, notes, and snippets.

@johannilsson
Created March 1, 2013 16:45
Show Gist options
  • Save johannilsson/5065953 to your computer and use it in GitHub Desktop.
Save johannilsson/5065953 to your computer and use it in GitHub Desktop.
Quick and dirty tile sprite image from a set of pngs.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment