Apr 24
Apple’s iPhone Application Programming Guide lists that the iphone supports png, tiff, jpeg, gif, bmp, ice, cur, and xbm image formats, but of these it recommends the png format.  The guide goes on to say that the “iPhone OS includes an optimized drawing path for PNG images that is typically more efficient than other formats”.  I would like to see how specifically the iphone OS is optimized for drawing PNG images versus other formats, but I suspect that is for Apple to know and for me to pontificate about.

Regardless, png is a good format that leaves little to be complained about; it supports up to a 64 bit color depth, and transparency. Another upside to png is that they are compressed and the method by which they are compressed(the “deflate” algorithm) is lossless.  A jpeg image, by contrast, uses a lossy compression algorithm.

What some don’t know is that your png images may not be compressed as tightly as possible.  I discovered this recently after I generated a set of png images from a 3ds max animation.

For fun, I decided to search out tools that would optimize the size of png images.  I ended up trying four tools; PNGOUTWin, pngout, defltopt, and pngcrush.  PNGOUTwin costs $15 and is available for Windows only, while the others  are available for OS X , Windows, and Linux and are free.  All of the tools are command line executables except PNGOUTwin which has a GUI.

While I did not perform a fully exhaustive survey of the different tools, I did try each of the tools with the image shown above.  This image is one in a sequence of about 100 images that make up an animation within my upcoming iphone application.  As already mentioned, this image was generated by 3ds max in the png format, and was 24,085 bytes.


Orignal File Size: 24,085 bytes
pngout: 21,709 (9.8% reduction)
PNGOUTwin: 22,110   (8.2% reduction) 21,970 (8.8% reduction)
pngcrush: 23,392 (2.8% reduction)
deflopt: 24,051 (0.1 % reduction)

So, from this limited test, pngout was the winner.  However, if you happen to have an irrational fear of the command line, PNGOUTwin came in a pretty close second place.
Tagged with:
preload preload preload