Handy iPhone Dev Tool: Convert “iPhone Formatted” Images Back to Regular PNGs with iPhonePNG

by Clint on February 10, 2009

The preferred image file format used by iPhone applications is PNG, so most apps come bundled with a few *.png files. When a developer builds an iPhone application, a tool called “pngcrush” is used to compress these images; this makes the application smaller and quicker (the rationale being: you can load small files into memory faster than large ones).

By default, only the iPhone OS can display images that have been compressed with pngcrush; OS X, for example, doesn’t know how to read them. This can be a problem if you’re reverse-engineering an existing iPhone app and you want to study its images.

The solution is to use a handy utiltity created by David Watanabe, called iPhonePNG. It’s a simple command-line program you use to convert “pngcrushed” PNG files to “regular” PNG files. Very handy.

Clint Harris is an independent software consultant living in Brooklyn, New York. He can be contacted directly at ten.sirrahtnilc@tnilc.
  • http://www.kylinworks.com Autinhorse

    After searching on web for this topic, I decide to make a Java version by myself. It can run on any platform, and convert a bundle of files by one click.
    Here you can find Jar file and source code of it.

    http://www.kylinworks.com/products/PNGConverter/PNGConverter.php

    Hope it can be helpful.

  • Pingback: Provigil.

  • http://twitter.com/tomgidden Tom Gidden

    Incidentally, the version of pngcrush included in the XCode 4.2 developer tools now has a “-revert-iphone-optimizations” switch.

  • http://www.facebook.com/profile.php?id=568255489 Christian Wick

    Tom: Where is that in Xcode?

  • http://www.facebook.com/RichardAGroves Richard Groves

    pngcrush is here: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush

  • http://www.facebook.com/RichardAGroves Richard Groves

    And here is a little bash script that will revert all the png’s in a folder to copies in a subfolder called ‘reverted’:

    #!/bin/bash

    THE_FILES=(*.png)
    mkdir ./reverted

    for (( i = 0; i do
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q ${THE_FILES[$i]} ./reverted/${THE_FILES[$i]}
    echo "Reverted ${THE_FILES[$i]}"
    done

  • http://www.facebook.com/david.rogoff David Rogoff

    Richard – thanks for the script!

  • Trevor Green

    i-Funbox is the way to go. Simple and Free. does a lot more than just png files too