1. The Making of Chromocam: Hi-Res iPhoneography

    Over at the iPhoneography blog, as well as at Life in LoFi, the authors are lamenting the fact that many iPhone apps save at a low resolution. And they are puzzled, as they should be. Why would some apps like CameraBag or MonoPhix save at nice resolutions, and yet others save at 320 x 480, the iPhone screen resolution? Well, the answer is… lazy programmers.

    I can’t say that I blame the programmers though. Apple has not made it particularly easy to play with large image buffers in memory. Actually, they’ve made working with images extraordinarily easy, as long as you are just displaying them and maybe moving them here and there. But rotating, applying filters, working byte by byte with them gets a little trickier. I blame a particularly enticing line of code:

    [view.layer renderInContext:UIGraphicsGetCurrentContext()];

    What this does, in one shot, is take whatever view and dump its display to a coregraphics context. Then, you can use UIGraphicsGetImageFromCurrentImageContext() and you have a UIImage of whatever view you want. The problem with this, is that the maximum view size on the iphone is… 320 x 480. So that’s why you have tons of apps saving at that low resolution.

    I will cover how to efficiently and safely deal with large images in another entry, but suffice it to say, it is hundreds of times more complex, and rotating, translating, and eating bytes of an image is pretty memory intensive, so special care must be taken not to crash your app. Interested developers should check out all the great info out there on coregraphics contexts. Or just wait for an upcoming entry…