My app adds a filter to a selected image. The app works like this:
- An image is selected from an image picker
- The image is loaded as an ivar of my view controller
- A button is pressed to add the filter to the image
When I press the button to add a filter, the main image view goes completely white. However, when I initially load the image from the picker, it shows up fine. Here's the code that adds the filter.
- (IBAction)addFilter:(id)sender {
if(_imageToFilter)
{
CIImage *newImage = _imageToFilter.CIImage;
CIFilter *myFilter = [CIFilter filterWithName:@"CIColorInvert" keysAndValues:@"inputImage",newImage, nil];
CIImage *filteredImage = [myFilter outputImage];
UIImage *outputImage = [UIImage imageWithCIImage:filteredImage];
[mainImage setImage:outputImage];
}
}