Required Reading: Xcode, the iPhone, and Image Optimization

by Clint on May 28, 2009

Image used with permission from Landon Cahow, redzephyrdesign.com

Image courtesy of Landon Cahow, redzephyrdesign.com

If you’re an iPhone developer you’ll inevitably need to work with images at some point. It’s extremely easy to load and display images in a variety of formats such as PNG, JPEG, etc. That said, the easy route isn’t always the most efficient; taking the time to learn how the iPhone handles images (e.g., storing each pixel with Blue/Green/Red/Alpha-ordered octets instead of Red/Green/Blue) and how to use that knowledge to your advantage is definitely a worthwhile investment.

For example, the official Apple documentation suggests that you use the PNG image format for iPhone graphics and briefly mentions that Xcode does some sort of “optimization” on each .png file during a device build. What does this mean? Just how much more efficient is one of these mysterious “optimized” PNG files? Who knows! Apple doesn’t tell us.

Fortunately Jeff LaMarche took the time to write up an excellent, short, easy-to-read yet thorough explanation regarding the iPhone, image formats, and PNG optimization (link). Personally I feel like this should be required reading for all new iPhone developers (and I wish I had found the article sooner!).

Clint Harris is an independent software consultant living in Brooklyn, New York. He can be contacted directly at ten.sirrahtnilc@tnilc.