PNGOut

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
Output size: 6000 bytes
Change: -1119 bytes ( 84% of original)

real 0m1.651s
user 0m0.528s
sys 0m0.018s

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 0m1.302s
user 0m0.517s
sys 0m0.017s

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
Output size: 5012 bytes
Change: -2421 bytes ( 67% of original)

real 1m8.858s
user 0m27.696s
sys 0m0.553s

Input: x11_1.png coltype:6 (RGB+Alpha)
Output: small.png coltype:6 (RGB+Alpha) filter:5 (mixed)

Input size: 7433 bytes
Output size: 5083 bytes
Change: -2350 bytes ( 68% of original)

real 1m25.449s
user 0m32.361s
sys 0m0.661s

Input: x11_1.png coltype:6 (RGB+Alpha)
Output: small.png coltype:6 (RGB+Alpha) filter:5 (mixed)

Input size: 7433 bytes
Output size: 5045 bytes
Change: -2388 bytes ( 67% of original)

real 1m57.364s
user 0m45.984s
sys 0m0.978s

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.

This entry was posted in Local Talk. Bookmark the permalink.
  • http://www.rocr.net/ Reinder

    Well, I downloaded it but can’t get it to work at all. I use it on the two other systems I have access to, a workplace PC running Windows and a home PC running linux, but on the iBook, it doesn’t do a thing even after chmodding. What am I doing wrong?

  • http://jamesbadger.ca/ James

    That’s odd, I haven’t encountered any problems yet (knock on wood). What version of OS X are you running, and where did you download the Mac version from?

    I haven’t had any problems with Mr. Fowler’s port, and I’m running Tiger (10.4.6).