I'm trying to create a CIFilter with blend mode (like overlay or multiply). Relevant code:
// Let's try a filter here
// Get the data
NSData *imageData = UIImageJPEGRepresentation(image, 0.85);
// Create a CI Image
CIImage *beginImage = [CIImage imageWithData:imageData];
CIImage *overlay = [CIImage imageWithColor:[CIColor colorWithRed:0.7 green:0.75 blue:0.9 alpha:0.75]];
// Create a context
CIContext *context = [CIContext contextWithOptions:nil];
// Create filter
CIFilter *filter = [CIFilter filterWithName:@"CIOverlayBlendMode"
keysAndValues:@"inputImage", beginImage,
@"inputBackgroundImage", overlay,
nil];
Other filters are working okay (like sepia tone), but with a filter that requires a "inputBackgroundImage" key, I get a blank/empty result ... so something seems to be wrong with my background image.
How do I use a blend mode filter by placing a solid color over an image?
overlay
image is being generated properly when you use-imageWithColor:
? Is it non-nil? Can you create a UIImage from it that looks correct? – Rubato