writeImageAtIndex:1012: ⭕️ ERROR: 'App' is trying to save an opaque image (5712x4284) with 'AlphaLast'.

I have an app that edits photos in your library. When I call

try CIContext().writeHEIFRepresentation(of: editedImage, to: fileURL, format: .RGBA8, colorSpace: originalImage.colorSpace!)

The following is logged to the console:

writeImageAtIndex:1012: ⭕️ ERROR: 'App' is trying to save an opaque image (5712x4284) with 'AlphaLast'. This would unnecessarily increase the file size and will double (!!!) the required memory when decoding the image --> ignoring alpha.

What does that mean and how can I resolve it?

Xcode Version 16.0 (16A242d)

iOS 18.1 (22B82)

Answered by DTS Engineer in 814472022

Hello. Thank you for bringing this to our attention.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a small Xcode project and some directions for using the project to reproduce the problem, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

I am currently investigating this issue as part of a TSI and I will post the results of that investigation here when done.

Same here. ✋

Same here. ✋✋

Hello. Thank you for bringing this to our attention.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a small Xcode project and some directions for using the project to reproduce the problem, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

I am currently investigating this issue as part of a TSI and I will post the results of that investigation here when done.

A temporary workaround I found is to use RGB10 format for opaque images.

writeImageAtIndex:1012: ⭕️ ERROR: 'App' is trying to save an opaque image (5712x4284) with 'AlphaLast'.
 
 
Q