CGBitmapContextCreate: unsupported parameter combination

Posted by tarmes on Stack Overflow See other posts from Stack Overflow or by tarmes
Published on 2012-11-23T10:58:29Z Indexed on 2012/11/23 10:59 UTC
Read the original article Hit count: 591

Filed under:
|

I'm getting this error when creating a bitmap context:

CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 7936 bytes/row.

Here's the code (note that the context is based on the parameters of an existing CGImage:

context = CGBitmapContextCreate(NULL,
                                (int)pi.bufferSizeRequired.width,
                                (int)pi.bufferSizeRequired.height,
                                CGImageGetBitsPerComponent(imageRef),
                                0,
                                CGImageGetColorSpace(imageRef),
                                CGImageGetBitmapInfo(imageRef));

Width is 2626, height is 3981. I've leaving bytesPerRow at zero so that it gets calculated automatically for me, and it's chosen 7936 of its own accord.

So, where on Earth is the inconsistency? It's driving me nuts.

© Stack Overflow or respective owner

Related posts about osx

Related posts about core-graphics