summaryrefslogtreecommitdiff
path: root/nekowatchlet/original-resources/makeatlas.sh
blob: e04a50f53ad5e1615133573bbade4a2679e94a48 (plain)
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
29
30
31
32
#!/bin/bash

set -e

allfiles=$(echo *.png | sort)
atlasfiles=""
stems=""

for i in $allfiles
do
	echo $i
	if [[ $i =~ ^([a-z]+)[1-9].png ]]
	then
		stem=${BASH_REMATCH[1]}
		output=atlas/$stem.png
		if [[ $atlasfiles != *$output* ]]
		then
			montage $stem?.png -geometry 32x32 $output
			atlasfiles="$atlasfiles $output"
			stems="$stems $stem"
		fi
	fi
done

montage $atlasfiles -geometry 64x32+0+0 -gravity NorthWest -tile 1x atlas/atlas.png

rm -f $atlasfiles

echo $stems | tr ' ' '\n' > atlas/atlas.txt

exit 0