Created
November 27, 2013 07:03
-
-
Save hjazz/7671724 to your computer and use it in GitHub Desktop.
adopt GaussianBlur Fiilter to UIImage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImage *myImage = [UIImage imageNamed:@"some_image"]; | |
CIContext *context = [CIContext contextWithOptions:nil]; | |
CIImage *inputImage = [CIImage imageWithCGImage:myImage.CGImage]; | |
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; | |
[filter setValue:inputImage forKey:kCIInputImageKey]; | |
[filter setValue:@8.f forKey:@"inputRadius"]; // Default Value is 10.f | |
CIImage *result = [filter valueForKey:kCIOutputImageKey]; | |
CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]]; | |
self.imageView.image = [UIImage imageWithCGImage:cgImage]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment