Skip to content

Instantly share code, notes, and snippets.

@muriloazevedo
Forked from hotzenklotz/spritemaker
Last active August 29, 2015 14:19
Show Gist options
  • Save muriloazevedo/9979a4f61292722ab2fa to your computer and use it in GitHub Desktop.
Save muriloazevedo/9979a4f61292722ab2fa to your computer and use it in GitHub Desktop.
#!/bin/bash
# use imagemagick to merge all images in a folder to produce a spritesheet
# use conver -append for vertical stacking and
# convert +append for horizontal
if [ $# -gt 0 ]
then
if [ $2 ]
then
ext="."$2; # the extension to iterate over for input files
else
ext=".png"; # default extension
fi
classname=$1"-sprite";
echo "Generating sprite file...";
convert *$ext +append ./$classname$ext;
echo "Sprite complete!"
else
echo -e "Provide at least 1 argument!\nbuildSprite.sh spriteName input_extension"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment