georgec0 Posted February 27, 2016 Share Posted February 27, 2016 (edited) 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: http://iphonedevwiki.net/index.php/CgBI_file_format http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html 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 May 7, 2016 by georgec0 Quote Link to comment Share on other sites More sharing options...
Zagna Posted February 27, 2016 Share Posted February 27, 2016 (edited) Bit of googling found PNGDecrush, a C# library for exactly that. Maybe one of the more experienced plugin makers can use that? Or you could use Color Matrix and in it there's "RGB to BGR (or back)" setting. Edited February 27, 2016 by Zagna Quote Link to comment Share on other sites More sharing options...
dipstick Posted February 27, 2016 Share Posted February 27, 2016 I'm getting a security warning on the site you linked to. Post the zip file here directly. Quote Link to comment Share on other sites More sharing options...
georgec0 Posted February 28, 2016 Author Share Posted February 28, 2016 (edited) 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 May 7, 2016 by georgec0 Quote Link to comment Share on other sites More sharing options...
dipstick Posted February 29, 2016 Share Posted February 29, 2016 I can open that iphone png image in PDN v4.0.9, but I don't know which file type plugin is used to open it. The colors are wrong on import. PDN assumes it is RGBA instead of BGRA. Using the Color Matrix plugin does work... Quote Link to comment Share on other sites More sharing options...
georgec0 Posted March 1, 2016 Author Share Posted March 1, 2016 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.