mozilla-b2g/gaia — pull request #5882 by gabrielesvelto (2012-10-18 14:36:47+00:00)
Title: Bug 799167 - Add a script to recompress PNG files using the optipng and advpng tools

A script to re-compress PNG files has been added under the tools/ directory. It requires the 'optipng' and 'advpng' tools (from the 'optipng' and 'advancecomp' packages on most Linux distributions as well as macports/homebrew for Mac). The script should also work on Macs, it can be used to recompress single files:

png_compress.sh foo.png bar.png

All files under a directory:

png_compress.sh shared/style/action_menu/images/ui

Or recursively on all files found starting from a top-level directory:

png_compress.sh --recursive gaia

Using the '--verbose' flag will print out stats, here's an example:

png_compress.sh --verbose shared/style/action_menu/images/ui

shared/style/action_menu/images/ui/alpha.png 993 68 0.068
shared/style/action_menu/images/ui/pattern.png 6851 6851 1.000
shared/style/action_menu/images/ui/default.png 1014 82 0.080

Number of files processed: 3
Total size of the files prior to recompression: 8858
Total size of the files after recompression: 7001
Compression ratio: 0.790

Using the '--help' parameter will print out an help message with all available options.