I recently stumbled upon a program called PNGOut, which supposedly is incredibly efficient at compressing png files. The creator, Ken Silverman, created the original version for Windows, and was ported to OS X/Linux by Jonathon Fowler. After a couple unsuccessful download attempts, the download magically worked, and I had a binary of PNGOut!
Now, let’s see how well it really works.
I copied over the binary to /usr/local/bin, where I keep custom command-line programs. Running it on a couple image files, I can say I was impressed. For example, these images (border added via CSS — not part of actual image):


They are 6.0 KiB and 7.3 KiB, respectively. Seeing as I enjoy tabulating data (not necessarily a bad thing!), here’s some test data I tried.
Table 1: php.png, 95×51 px
| command | $ time pngout php.png php2.png | $ time pngout -b128 x11_1.png small.png | $ time pngout -b1024 php.png php2.png |
| output | Input: php.png coltype:6 (RGB+Alpha) Output: php2.png coltype:6 (RGB+Alpha) filter:5 (mixed)) ) Input size: 7119 bytes) Output size: 6000 bytes ) Change: -1119 bytes ( 84% of original)) ) real 0m0.893s) user 0m0.521s) sys 0m0.016s |
Input: php.png coltype:6 (RGB+Alpha) Output: php2.png coltype:6 (RGB+Alpha) filter:5 (mixed) Input size: 7119 bytes real 0m1.651s |
Input: php.png coltype:6 (RGB+Alpha) Output: php2.png coltype:6 (RGB+Alpha) filter:5 (mixed) Input size: 7119 bytes real 0m1.302s |
| time | 0.893 seconds | 1.651 seconds | 1.302 seconds |
Table 2: x11_1.png, 484×338 px
| command | $ time pngout -b1024 x11_1.png small.png | $ time pngout -b128 x11_1.png small.png | $ time pngout x11_1.png small.png |
| output | Input: x11_1.png coltype:6 (RGB+Alpha) Output: small.png coltype:6 (RGB+Alpha) filter:5 (mixed) Input size: 7433 bytes real 1m8.858s |
Input: x11_1.png coltype:6 (RGB+Alpha) Output: small.png coltype:6 (RGB+Alpha) filter:5 (mixed) Input size: 7433 bytes real 1m25.449s |
Input: x11_1.png coltype:6 (RGB+Alpha) Output: small.png coltype:6 (RGB+Alpha) filter:5 (mixed) Input size: 7433 bytes real 1m57.364s |
| time | 1 minute, 9 seconds | 1 minute, 26 seconds | 1 minute, 58 seconds |
As you can see, larger images take longer to process; I’d imagine a larger image (desktop size) would take considerable more time to process. It seems the time required is more dependent on dimensions, although I didn’t test any image with a large colour palette. Taking a close look shows no discernible image quality change. For what it’s worth, spending a couple minutes to shave off a few percent is useful, especially in high traffic websites.
Feel free to give it a shot, the download links are below.
References
Ken Silverman’s Utilities
Jonathon Fowler’s Ports
Additional (May 06)
Here’s a handy command to optimize all the PNG files in the current directory, using Terminal:
find . -iname "*.png" -print0 | xargs -0 -n1 pngout
See the man pages for find and xargs for more customization.