-
-
Save muriloazevedo/9979a4f61292722ab2fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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