-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Apple has an unofficial PNG extension, used by their tools (a modified pngcrush: xcrun -sdk iphoneos pngcrush -iphone) to create iOS app assets.
If you're updating the PNG spec to 3.0, consider making it official. It might not be the extension I would have designed, but if there's millions of iOS devices out there, there's zillions of PNG/CgBI images already out there in the real world.
I don't have official documentation, but here's what others have deduced:
- a CgBI chunk before IHDR (a serialization of a CGBitmapInfo struct).
- an optional iDOT chunk before IDAT.
- BGRA not RGBA.
- premul alpha not non-premul alpha.
- Raw zlib (i.e. deflate), no zlib header and no Adler-32 checksum.
https://iphonedev.wiki/index.php/CgBI_file_format
https://github.com/DHowett/pincrush
https://www.hackerfactor.com/blog/index.php?/archives/895-Connecting-the-iDOTs.html
http://jongware.com/pngdefry.html
This has an example PNG/CgBI image.
https://github.com/jakubknejzlik/cgbi-to-png
This has an example PNG/CgBI image. Not sure if their code does the premul -> non-premul conversion properly.
https://axelbrz.com/?mod=iphone-png-images-normalizer
Not sure if their code does the premul -> non-premul conversion properly.