summaryrefslogtreecommitdiff
path: root/tools/gentextures.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gentextures.sh')
-rw-r--r--tools/gentextures.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/gentextures.sh b/tools/gentextures.sh
new file mode 100644
index 0000000..cacd968
--- /dev/null
+++ b/tools/gentextures.sh
@@ -0,0 +1,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