public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.