summaryrefslogtreecommitdiff
path: root/iencode.sh
diff options
context:
space:
mode:
Diffstat (limited to 'iencode.sh')
-rwxr-xr-xiencode.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/iencode.sh b/iencode.sh
index 990d027..460db3b 100755
--- a/iencode.sh
+++ b/iencode.sh
@@ -5,6 +5,8 @@ CWEBP=cwebp
# configure flags
CWEBP_FLAGS="-m 6"
+set -e
+
cd $(dirname $0)/www/dump
iencode() {
@@ -15,9 +17,16 @@ iencode() {
find . -name \*."${EXT}" -print0 | xargs -0 -P ${THREADS} -n 1 bash -c '
IN="$0"
OUT="${IN%.${EXT}}.webp"
- ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT}
+ [[ -f ${OUT} ]] || ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT}
'
}
iencode jpg 90
iencode png 99
+
+if hash zopflipng; then
+ find . -name \*.png -print0 | xargs -0 -I '{}' -P ${THREADS} zopflipng -my '{}' '{}'
+else
+ echo >&2 "Install zopfli (https://code.google.com/p/zopfli/) to improve PNG compression."
+ echo >&2 "Approximately 2% savings can be seen across the board, with no cost to quality."
+fi