From 19acd9e334141a947f88c4272249da5d1709c269 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 29 Aug 2018 22:15:49 +0200 Subject: [PATCH] script to pre-compress all included graphics --- tools/png-pre-compress | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/png-pre-compress diff --git a/tools/png-pre-compress b/tools/png-pre-compress new file mode 100755 index 0000000000..dba3d1cb0a --- /dev/null +++ b/tools/png-pre-compress @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +set -e +set -x + +for f in $(dirname $0)/../metadata/*/*/*/*.jp*g; do + exiftool -all= $f +done + +for f in `find $(dirname $0)/../metadata -type f -name \*.png`; do + echo $f | grep -Eo '\.9\.png$' && continue # do not optimized 9-patch, it breaks them + tmpfile=$(mktemp) + aapt singleCrunch -v -i $f -o $tmpfile + exiftool -all= $tmpfile + mv $tmpfile $f +done + +for f in metadata/*/*/*Screenshots/*.png; do + exiftool -all= $f + tmpfile=$(mktemp) + (zopflipng --filters=01234mepb --lossy_8bit --lossy_transparent -y $f $tmpfile && mv $tmpfile $f) & +done