]> git.saurik.com Git - cydia.git/blame - pngcrush.sh
Replace all Objective-C memory managment with _H<>.
[cydia.git] / pngcrush.sh
CommitLineData
7fc02989
JF
1#!/bin/bash
2
3png=$1
4steps=()
5
6function step() {
7 "$@"
8 mv -f {_,}_.png
9 steps+=($(stat -f "%z" _.png))
10}
11
12pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
13
14grep CgBI "${png}" &>/dev/null && exit 0
15
16step 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
23step "${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
29mv -f _.png "${png}"
30
31echo -n "${png##*/} "
32for ((i = 0; i != ${#steps[@]}; ++i)); do
33 if [[ $i != 0 ]]; then
34 echo -n " "
35 fi
36
37 echo -n "${steps[i]}"
38done
39
40printf $' %.0f%%\n' "$((steps[${#steps[@]}-1] * 100 / steps[0]))"