Related issue report:
iOS 17 Indexed PNG decode wrong which report alpha info to non-premultiplied RGBA, but bitmap array is premultiplied
From iOS 17/macOS 14, there is one serious problem on ImageIO PNG plugin. The decode result for indexed color PNG use the wrong CGImageAlphaInfo
The returned CGImageAlphaInfo is alpha last, but the actual bitmap data is premultiplied alpha last, which cause many runtime render bug.
I already submit a radar FB13196663 to UIKit team, but seems iOS 17.2 still contains this issue. After digging into details, I think this radar should reported to ImageIO team.
- Just download my “iOS17IndexedPNGDecodeBug.zip” in attachment, which provide a one pixel PNG image
- Open “iOS17IndexedPNGDecodeBug.xcodeproj”
- Run with destination on iOS 16 device or simulator, no assertion failed. The pixel value (50, 50, 50, 50)
- Run with destination on iOS 17 device or simulator, hit assertion, because the pixel value (10, 10, 10, 50), which looks like the premultiplied result
Both iOS 17 and iOS 16 decode result for that indexed color PNG should match. Well ImageIO team can use premultiplied RGBA, but please, you at least should create CGImage
with the correct CGImageAlphaInfo.
Currently we have no good workaround to solve this, this break many render pipeline when convert the ImageIO decoded CGImage into other pixel buffers.