CGImageCreate returns null

CGImageRef __nullable CGImageCreate(size_t width, size_t height,
    size_t bitsPerComponent, size_t bitsPerPixel, size_t bytesPerRow,
    CGColorSpaceRef cg_nullable space, CGBitmapInfo bitmapInfo,
    CGDataProviderRef cg_nullable provider,
    const CGFloat * __nullable decode, bool shouldInterpolate,
    CGColorRenderingIntent intent)

function returns null when kCGImageAlphaNone is passed for bitmap info with error message "verify_image_parameters: invalid image alphaInfo: kCGImageAlphaNone. It should be kCGImageAlphaNoneSkipLast"

This issue happens only when installing on iOS 17 from XCode 15(Swift 5). Is it possible to fix this problem without having change the bitmap info as that can affect other parts of image processing.

I guess you have set 32 bits per pixel, right?

Does your data actually have 32 bits per pixel, or 24?

I am facing the same issue in my app as well. Any solutions yet? Changing to 24 bit works but the image has coloured lines over it or is distorted.

if (@available(iOS 17.0, *)) {
    bitmapInfo |= kCGImageAlphaPremultipliedLast;
}
CGImageCreate returns null
 
 
Q