Compress png images on osx using pngcrush
Xcode comes bundled with pngcrush
, you can find it here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
Add it to your path in your .bash_profile
or .zshrc
to avoid typing in the long nested directories.
export PATH="$PATH:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/"
If you don’t have Xcode then install using homebrew
brew install pngcrush
usage
pngcrush [options] infile.png outfile.png
options
Options are optional, some interesting ones to note are:
- -iphone (optimize for iPhone OS)
- -revert-iphone-optimizations (convert iPhone OS optimized PNG to a PNG readable on other platforms)