summaryrefslogtreecommitdiff
path: root/tools/gentextures.sh
blob: cacd968706e51f60780c85ed2983a66e005cfa64 (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
33
34
35
36
#!/bin/bash

# 2022
# depression: c4ab8b b39e83
# depression (old): c4bd9c
# marsh: 939874 747e5c
# mountain: b3b37d 9a9a6e
# desert: ccbda4 d6c5aa

cat tools/wetland.pbm | pgmtoppm "#747e5c-#939874" | ppmquant 2 | pnmtopng > texture_marsh.png
#pngtopnm tools/scree_overlay@2x.png | pgmtoppm "black-#c4ab8b" | ppmquant 2 | pnmtopng > texture_scree.png
pngtopnm tools/scree_overlay@2x.png | pgmtoppm "black-#c4bd9c" | ppmquant 2 | pnmtopng > texture_scree.png
#pngtopnm tools/rock_overlay@2x.png | pnmnorm | pgmtoppm "#aaa26f-#bab079" | ppmquant 2 | pnmtopng > texture_mountain.png
pngtopnm tools/rock_overlay@2x.png | pnmnorm | pgmtoppm "#9d9d6a-#aaaa77" | ppmquant 2 | pnmtopng > texture_mountain.png
pngtopnm tools/rock_overlay@2x.png | pnmnorm | pgmtoppm "#ccbda4-#d6c5aa" | ppmquant 2 | pnmtopng > texture_clear.png
pngtopnm tools/rock_overlay@2x.png | pnmnorm | pgmtoppm "#bba487-#c4ab8b" | ppmquant 2 | pnmtopng > texture_depression.png

for PNG in texture_*.png
do
	zopflipng -y $PNG $PNG
done

exit 0

OUT=textures.svg
rm -f $OUT
for PNG in texture_*.png
do
SIZE=$(file $PNG | sed 's/[^0-9]*//;s/ .*//')
echo '<pattern id="'${PNG/.png/}'" width="'$SIZE'" height="'$SIZE'" patternUnits="userSpaceOnUse">' >> $OUT
echo '<image width="'$SIZE'" height="'$SIZE'" xlink:href="data:image/png;base64,' >> $OUT
base64 $PNG >> $OUT
echo '"/>' >> $OUT
echo '"</pattern>' >> $OUT
echo >> $OUT
done