I have the following code to create a new bitmap graphics context.
NSLog(@"newRect Width %f",newRect.size.width);
NSLog(@"newRect Height %f",newRect.size.height);
NSLog(@"imageRef %@",imageRef);
CGContextRef bitmap = CGBitmapContextCreate(NULL,
newRect.size.width,
newRect.size.height,
CGImageGetBitsPerComponent(imageRef),
0,
CGImageGetColorSpace(imageRef),
CGImageGetBitmapInfo(imageRef));
The newRect.size.width is the result of dividing the original width of UIImage by 2. The newRect.size.height is the result of dividing the original height of UIImage by 2.
But for some UIImages with sizes {3000, 2002},{3024, 4032},{4032, 3024} are okay and returning bitmap context.
But for some UIImages with sizes {1242, 2208}. Normally these are screenshots from my devices and returning NULL value.
Is anyone can help on my issue. Thanks.