]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add example script that optimizes the size of badge images
authorSeverin Meyer <sev.ch@web.de>
Tue, 11 Oct 2016 14:15:01 +0000 (16:15 +0200)
committerSeverin Meyer <sev.ch@web.de>
Tue, 11 Oct 2016 14:15:01 +0000 (16:15 +0200)
xonstat/batch/badges/optimize.sh [new file with mode: 0755]

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