]> git.saurik.com Git - cydia.git/blob - pngcrush.sh
Reload/nil buttons for ConfirmationController were backwards.
[cydia.git] / pngcrush.sh
1 #!/bin/bash
2
3 png=$1
4 steps=()
5
6 function step() {
7 "$@"
8 mv -f {_,}_.png
9 steps+=($(stat -f "%z" _.png))
10 }
11
12 pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
13
14 grep CgBI "${png}" &>/dev/null && exit 0
15
16 step cp -fa "${png}" __.png
17
18 #step "${pngcrush}" -q -rem alla -reduce -brute -iphone {,_}_.png
19
20 #step "${pngcrush}" -q -rem alla -reduce -brute {,_}_.png
21 #step pincrush {,_}_.png
22
23 step "${pngcrush}" -q -rem alla -reduce -iphone {,_}_.png
24
25 #"${pngcrush}" -q -rem alla -reduce -brute -iphone "${png}" 1.png
26 #"${pngcrush}" -q -iphone _.png 2.png
27 #ls -la 1.png 2.png
28
29 mv -f _.png "${png}"
30
31 echo -n "${png##*/} "
32 for ((i = 0; i != ${#steps[@]}; ++i)); do
33 if [[ $i != 0 ]]; then
34 echo -n " "
35 fi
36
37 echo -n "${steps[i]}"
38 done
39
40 printf $' %.0f%%\n' "$((steps[${#steps[@]}-1] * 100 / steps[0]))"