Skip to content

Instantly share code, notes, and snippets.

@mdp
Created December 1, 2008 14:46
Show Gist options
  • Save mdp/30740 to your computer and use it in GitHub Desktop.
Save mdp/30740 to your computer and use it in GitHub Desktop.
#!/bin/sh
# PNGCrush Script
# Copyright James Mates -- http://sial.org/blog/scripts/
# Color information stripping added by Mark Percival - http://mpercival.com
if [ -z "$1" ]; then
echo "Usage: `basename $0` png-image [...]" >&2
exit 1
fi
for file in "$@"; do
TMPFILE=`mktemp .crush-png-tmp.XXXXXXXX` || exit 1
pngcrush -brute -fix -reduce -rem gAMA -rem cHRM -rem iCCP -rem sRGB "$file" "$TMPFILE" 1>/dev/null || exit 1
mv "$TMPFILE" "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment