CGImageCreate() returns nil.


 CGFloat width = any value;
 CGFloat height = any value;

  CGDataProviderRef dataProviderRef = dataProviderRef = CGDataProviderCreateWithData(NULL, data, width * height * 2, nil);

  CGBitmapInfo bitmapInfo = kCGBitmapByteOrderMask | kCGImageAlphaNoneSkipLast;

  CGImageRef imageResult = CGImageCreate(width, height, 8, 16, width * 2, CGColorSpaceCreateDeviceGray(), bitmapInfo, dataProviderRef, NULL, 0, kCGRenderingIntentDefault);

imageResult is nil. Please tell me an alternative method.

Please post your actual code. What width and height are you actually passing? What have you changed in the third line?

You don't want kCGBitmapByteOrderMask. You need to pass one of the actual byte order values, e.g. kCGBitmapByteOrder16Little.

CGImageCreate() returns nil.
 
 
Q