imageFromCurrentlyProcessedOutputWithOrientation not setting CGBitmapInfo correctly?
Hi Brad, The problem I'm having is described in Issue #321.
Based on reading this link: http://stackoverflow.com/questions/6861891/how-do-you-generate-an-rgba-image-in-core-graphics
I made this change in imageFromCurrentlyProcessedOutputWithOrientation that fixed my problem(else condition, changed : kCGBitmapByteOrderDefault | kCGImageAlphaLast --> kCGImageAlphaPremultipliedLast)
From: if ([GPUImageOpenGLESContext supportsFastTextureUpload] && preparedToCaptureImage) { cgImageFromBytes = CGImageCreate((int)currentFBOSize.width, (int)currentFBOSize.height, 8, 32, CVPixelBufferGetBytesPerRow(renderTarget), defaultRGBColorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst, dataProvider, NULL, NO, kCGRenderingIntentDefault); } else { cgImageFromBytes = CGImageCreate((int)currentFBOSize.width, (int)currentFBOSize.height, 8, 32, 4 * (int)currentFBOSize.width, defaultRGBColorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaLast, dataProvider, NULL, NO, kCGRenderingIntentDefault); }
To:
if ([GPUImageOpenGLESContext supportsFastTextureUpload] && preparedToCaptureImage)
{
cgImageFromBytes = CGImageCreate((int)currentFBOSize.width, (int)currentFBOSize.height, 8, 32, CVPixelBufferGetBytesPerRow(renderTarget), defaultRGBColorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst, dataProvider, NULL, NO, kCGRenderingIntentDefault);
}
else
{
cgImageFromBytes = CGImageCreate((int)currentFBOSize.width, (int)currentFBOSize.height, 8, 32, 4 * (int)currentFBOSize.width, defaultRGBColorSpace, kCGImageAlphaPremultipliedLast, dataProvider, NULL, NO, kCGRenderingIntentDefault);
}
What do you think?
Thanks Peter
That might address the case you encountered when shutting off the texture caches, but it doesn't help with the primary case reported in that issue. Still, I'll check this out and if it doesn't have any odd side effects, I'll roll this into the capture code.
Yes, this doesn't address the artifacts issue. Thanks for looking into it.