aboutsummaryrefslogtreecommitdiffstats
path: root/image/compress-pngs
blob: 38723636724aaea38f51361674f3f4dfdebbe6c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

FILE_LIST_CMD="find . -type f -name \"*.png\""

if [ -n "$1" ] ; then
    FILE_LIST_CMD="echo $1"
fi

bash -c "$FILE_LIST_CMD" | while read PNG_FILE ; do
    echo Compressing $PNG_FILE
    hash optipng 2>/dev/null  && optipng -o3 -quiet "$PNG_FILE"
    hash advpng 2>/dev/null   && advpng -z -4 "$PNG_FILE"
    hash advdef 2>/dev/null   && advdef -z -4 "$PNG_FILE"
    hash pngcrush 2>/dev/null && pngcrush -q -ow -brute "$PNG_FILE"
done