UIImage.pngData() exports incorrect translucent colors in 16-bit PNGs

Hi there. I was responding to some user feedback reported in this PR, that suggests UIImage 16-bit PNG exports may incorrectly handle alpha premultiplication. I put together a public repro of the issue that you can find here demonstrating the issue via a playground.

Here's an LLM-generated summary of the problem:

On the iOS 26.5 simulator (23F77), I’m seeing UIImage.pngData() produce darker translucent colors when exporting a 16-bit image captured with UIGraphicsImageRenderer.

For a pixel drawn with UIColor(white: 0.96, alpha: 0.5), the PNG stores approximately 0.48 for its RGB samples and 0.50 for alpha. This appears to retain premultiplied colors, whereas PNG requires unpremultiplied colors. Exporting the same CGImage through ImageIO’s default PNG destination produces the expected 0.96 RGB and 0.50 alpha. An 8-bit standard-range control renders correctly through both exporters.

I assume this is a framework bug, but let me know if the behavior is expected for some reason. I've also filed feedback FB25109021 regarding this behavior. Thanks in advance.

UIImage.pngData() exports incorrect translucent colors in 16-bit PNGs
 
 
Q