Jump to content

Opening iPhone "optimized" PNGs, either directly or with a plugin


Recommended Posts

The CgBI file format, thus named for its extra header, is Apple's extension to the PNG image format. More details about the format can be found here:

I would really appreciate it if Paint.NET can open such "optimized" PNGs, either by itself or with the help of a plugin, so that I can save them as standard PNGs instead. If it helps, here's some C code I found for a utility called pngdefry that does the job, but having the ability to open such images in Paint.NET directly would be simply great. (Technically speaking the images do open, but the colors are all messed up.)
 
Thanks!

Edited by georgec0
Link to comment
Share on other sites

I'm getting a security warning on the site you linked to. Post the zip file here directly.

 

On ge.tt? Strange, been using that file host for ages with no security warnings. Anyway, I'd love to share the file here directly except for the small matter (pun intended) of the 256KB attachment limit.

 

 

Bit of googling found PNGDecrush, a C# library for exactly that.

 

Maybe one of the more experienced plugin makers can use that?

 

Thanks, that looks very promising too although I haven't tested it personally. If it does what it promises though then it should be much better than a simple BGR to RGB operation that will leave other things like the precomputed alpha values etc. untouched. Better to have a custom plugin that does the job properly as the PNGDecrush page describes.

Edited by georgec0
Link to comment
Share on other sites

Using the Color Matrix plugin does work...

Yes, in this case reversing just the colors from BGR to RGB does seem to work, but as I mentioned above it would be better to have a more thorough implementation like PNGDecrush's which can handle all cases by doing the following:

  • The CgBI chunk is removed
  • Chunk data is inflated and deflated again with zlib headers intact
  • The resulting PNG is read into .NET's standard image manipulation classes where:
    • The byte swap is reversed
    • The premultiplied alpha is reversed
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...