]> git.wh0rd.org Git - home.git/commitdiff
imgcrush: fix png crushing
authorMike Frysinger <vapier@gentoo.org>
Wed, 14 Feb 2018 05:03:03 +0000 (00:03 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 14 Feb 2018 05:03:03 +0000 (00:03 -0500)
.bin/imgcrush

index 51ba3438b909fa951121ca5b5aea1266f25c798c..854ad4d133983afecbcd0150bb0120f8269edd21 100755 (executable)
@@ -8,13 +8,15 @@ EOF
 }
 
 crush_jpg() {
-       jpegoptim "$1"
+       local img="$1"
+       jpegoptim "${img}"
 }
 
 crush_png() {
+       local img="$1"
        # apngopt likes to corrupt images.
-       pngcrush -e .png.new "$1"
-       mv "${png}.new" "${png}"
+       pngcrush -e .png.new "${img}"
+       mv "${img}.new" "${img}"
 }
 
 crush() {
@@ -31,6 +33,7 @@ main() {
        while [[ $# -ne 0 ]] ; do
                case $1 in
                -h) usage ;;
+               -x) set -x; shift ;;
                -*) usage 1 ;;
                *)  crush "$1"; shift ;;
                esac