xtorrent
best torrent app ever
newsfire
the news starts here
safari140
tweet!

iPhone .png Decoding

Anyone who has delved into the internals of the iPhone’s OS probably knows that, for whatever reason, .png files on the iPhone are encoded in a manner that makes them unreadable by normal image editing programs. There is a tool out there to handle the simple conversion, but this tool is a two-step process, only handles one file at a time, and doesn’t come precompiled. I took a few minutes the other day to produce an modified version (precompiled universal binary and source code included) that recursively handles foldered content and perform all necessary conversions in one step.

The usage is straightforward. In the Terminal, type “./iPhonePNG <input>” where <input> is either a single .png file or a folder. If you’re providing a folder, iPhonePNG will first create a full copy at the path <input>-Decoded, and then proceed to convert every .png file in the folder, leaving you with a folder with all original non-image content preserved and all .png resources decoded into a readable format.

This certainly isn’t something that will be useful to many people, but I wanted the tool for internal purposes and since it doesn’t cost anything to release, I might as well make the modifications public.

  • August 28th, 2007 3:01 am

17 comments...

Noel...

Thanks David!


jso...

Yes, thank you.


Collin...

Thanks! I was just poking around with the png files and wondering why they were unreadable by everything, and now I stumble upon this. I wonder what kind of craziness they’re doing… Perhaps the file structure changes are to support the higher DPI screens?


iPhone...

Thanks for the .png decoding tool! I was going nuts thinking my .png files were somehow being corrupted in transfer. I’ve got modding to do now…again, thanks!


Sean...

Just thought I’d let you know, you also have to unpremultiply the images as part of the conversion process. No iPhone png conversion tool that i’ve seen does this, but it is a necessary step. PNG files that ship with the iPhone are stored with channels swapped, and alpha premultiplied so that drawing them is faster. For images that don’t make use of the alpha channel, the premultiplication is not very noticeable, but for images like the icons, the shadows look awful unless you unpremultiply them. Just a heads up.


mt...

How can I encode .png images to iPhone format?


Создать...

David, Thank You!


Jonathan...

I cant get this to work.. how exactly do i do this.. i am not good with the terminal but i can understand but i just gives me a bash error…


Walt...

Is there any utility for going the other direction? That is, take a normal PNG and convert it to iPhone wallpaper format?


RupertGee...

Thanks for this! I had to use a Windows version until I found your blog.


kanda...

i want to update my mobile software


Kevin...

It’s important to note that transferring back the other way (regular PNG -> iPhone PNG) is not necessary, as the iPhone OS can read either format.


Chris...

Here can you convert online:

http://zope.release78.org/beta2/iconvert/


Col...

Thanks for this tool. It works great but…

I’m trying to get my hands on the UITabBar default icons. I don’t seem to be able to find them anywhere in the iPhone SDK. Does anyone know where I can find them?

Basically I just want to create my own custom icons but I want them to be in the same style.

cheers


Stephen...

Thank you. THe universal binary you offered in your post met my immediate need.


markus...

the xcode project won’t compile


Ivan...

Thank you, this really helps..