]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/batch/badges/optimize.sh
Add example script that optimizes the size of badge images
[xonotic/xonstat.git] / xonstat / batch / badges / optimize.sh
diff --git a/xonstat/batch/badges/optimize.sh b/xonstat/batch/badges/optimize.sh
new file mode 100755 (executable)
index 0000000..7d268b9
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh -e
+# Optimize png files in output directory
+
+find output -name "*.png" | while read png; do
+       # Reduce colors to 8bit
+       # <http://pngquant.org>
+       pngquant --skip-if-larger --force --output "$png" 256 "$png"
+
+       # Adjust bit depth, remove clutter
+       # <http://optipng.sourceforge.net>
+       optipng -o 1 -strip all "$png"
+
+       # Compress with zopfli
+       # <http://www.advancemame.it>
+       #advpng -z -4 "$png"
+done