Last active
December 29, 2015 04:39
-
-
Save inear/7616849 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 | |
# uses imagemagick to stich together all images in a folder. | |
# ex command: ./spriter.sh rivendell-title jpg 640 400 | |
if [ $# -gt 3 ] | |
then | |
folder=$1; | |
name=$1; # output will be placed in a folder named this | |
spritename=$1"-sprite"; | |
ext="."$2; | |
width=$3; | |
height=$4; | |
#create new folder, replace old | |
rm -fr $spritename; | |
mkdir $spritename; | |
echo "Generating sprite file..."; | |
FILES=$(ls $folder/*$ext | tr '\n' ' '); | |
montage +frame +shadow +label -tile 1x -gravity West -background transparent -geometry +0+0 -tile 2x8 -resize ${width}x${height} ${FILES[@]} $spritename/$name$ext; | |
echo "Sprite complete!"; | |
else | |
echo -e "There should be at least 3 argument!\n output_folder extension width height" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment