I'm generating a CIImage using a few chained filters and trying to output the generated image in the users photo album for certain debug purposes. The callback I supply to UIImageWriteToSavedPhotosAlbum()
always has a nil error returned, so I assume nothing is going wrong. But the image never seems to show up.
I've used this function in the past to dump OpenGL buffers to the photo album for debugging, but I realize this isn't the same case. Should I be doing something differently?
-(void)cropAndSaveImage:(CIImage *)inputImage fromFeature:(CIFaceFeature *)feature
{
// First crop out the face.
[_cropFilter setValue:inputImage forKey:@"inputImage"];
[_cropFilter setValue:[CIVector vectorWithCGRect:feature.bounds] forKey:@"inputRectangle"];
CIImage * croppedImage = _cropFilter.outputImage;
__block CIImage * outImage = croppedImage;
dispatch_async(dispatch_get_main_queue(), ^{
UIImage * outUIImage = [UIImage imageWithCIImage:outImage];
UIImageWriteToSavedPhotosAlbum(outUIImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
});
}
-(void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
NSLog(@"debug LBP output face. error: %@", error);
}
I've verified that the boundaries are never 0.
The callback output is always
debug LBP output face. error: (null)