Optimising PNG images for the web
Stoyan Stefanov has recently written an interesting series of articles on optimising image files for the web. In his latest article he shows how to use pngcrush to safely shrink your files, one file at a time:
$ pngcrush -rem alla -brute -reduce src.png dest.png
This evening I found myself wanting to repeat that command for all the PNG files in my current directory, and then (having reviewed the new images) overwrite the originals. Rather than do it by hand I did what all pragmatic programmers do these days, and wrote a script. Here it is in action:
$ pngcrushall Crushing test4012.png ... ok Crushing test9200a.png ... ok Crushing test9200b.png ... ok Overwrite original files? (y/N) y Overwriting test4012.png ... ok Overwriting test9200a.png ... ok Overwriting test9200b.png ... ok
You can get it from github -- download pngcrushall.
$ brew install pngcrush