summaryrefslogtreecommitdiff
path: root/pngcrush.sh
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-07 04:29:48 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-08 01:50:01 -0800
commitdf27070399c61922ec227823602f0d7f06043726 (patch)
tree76e4e961ca62ca5587d28ad62821bbf0bac50489 /pngcrush.sh
parent9f9ae81c2742d82fa45dcabceed3e988bdac095c (diff)
Add output filename parameter to pngcrush.sh.
Diffstat (limited to 'pngcrush.sh')
-rwxr-xr-xpngcrush.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/pngcrush.sh b/pngcrush.sh
index 69715fb..aa69576 100755
--- a/pngcrush.sh
+++ b/pngcrush.sh
@@ -1,6 +1,8 @@
#!/bin/bash
png=$1
+out=$2
+
steps=()
function step() {
@@ -11,7 +13,13 @@ function step() {
pngcrush=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
-grep CgBI "${png}" &>/dev/null && exit 0
+if grep CgBI "${png}" &>/dev/null; then
+ if [[ ${png} != ${out} ]]; then
+ cp -a "${png}" "${out}"
+ fi
+
+ exit 0
+fi
step cp -fa "${png}" __.png
@@ -26,7 +34,7 @@ step "${pngcrush}" -q -rem alla -reduce -iphone {,_}_.png
#"${pngcrush}" -q -iphone _.png 2.png
#ls -la 1.png 2.png
-mv -f _.png "${png}"
+mv -f _.png "${out}"
echo -n "${png##*/} "
for ((i = 0; i != ${#steps[@]}; ++i)); do