X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/7fc0298900fd912b962229f23d090fc422320019..b23b24db6ecef37ed83ad7167a30a0534cd3fbbf:/pngcrush.sh diff --git a/pngcrush.sh b/pngcrush.sh index 69715fbf..685a6af3 100755 --- a/pngcrush.sh +++ b/pngcrush.sh @@ -1,32 +1,45 @@ #!/bin/bash png=$1 +out=$2 + steps=() +src=${out}.src.png +dst=${out}.dst.png + +copy=("${src}" "${dst}") + function step() { "$@" - mv -f {_,}_.png - steps+=($(stat -f "%z" _.png)) + mv -f "${dst}" "${src}" + steps+=($(stat -f "%z" "${src}")) } -pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush +pngcrush=$(xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush + +if grep CgBI "${png}" &>/dev/null; then + if [[ ${png} != ${out} ]]; then + cp -a "${png}" "${out}" + fi -grep CgBI "${png}" &>/dev/null && exit 0 + exit 0 +fi -step cp -fa "${png}" __.png +step cp -fa "${png}" "${dst}" -#step "${pngcrush}" -q -rem alla -reduce -brute -iphone {,_}_.png +#step "${pngcrush}" -q -rem alla -reduce -brute -iphone "${copy[@]}" -#step "${pngcrush}" -q -rem alla -reduce -brute {,_}_.png -#step pincrush {,_}_.png +#step "${pngcrush}" -q -rem alla -reduce -brute "${copy[@]}" +#step pincrush "${copy[@]}" -step "${pngcrush}" -q -rem alla -reduce -iphone {,_}_.png +step "${pngcrush}" -q -rem alla -reduce -iphone "${copy[@]}" #"${pngcrush}" -q -rem alla -reduce -brute -iphone "${png}" 1.png #"${pngcrush}" -q -iphone _.png 2.png #ls -la 1.png 2.png -mv -f _.png "${png}" +mv -f "${src}" "${out}" echo -n "${png##*/} " for ((i = 0; i != ${#steps[@]}; ++i)); do