Cocoa in the Shell

qlImageSize now works for iPhone's PNG

As you may know, iPhone’s PNGs are crushed with a modified version of pngcrush, and so when you are trying to open them you get an error message. Of course, several tools exist to uncrush these files, but now with qlImageSize you can see their icons in the finder and also QuickLook them.

To do this, my first attempt was to use a NSTask with the Apple’s pngcrush command line tool, like the following :

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations input.png decoded.png

But, I was not satisfied for several reasons :

  • Needed to copy the binary inside the plugin for people who don’t have dev tools installed.
  • For each crushed PNG, a process was spawned to uncrush it.
  • A temporary image was written to disk, read into memory then deleted.

I don’t call this very efficient because that’s a lot of work for such a small task. Then I thought, what’s better than libpng to work with PNGs ?

So I coded a tiny library to uncrush an Apple’s PNG file and integrated it in qlImageSize. I’ll write a technical post about it later.

I updated the code in my github repo.

The new compiled version is also available here.