Skip to content

Instantly share code, notes, and snippets.

@hjazz
Created November 27, 2013 07:03
Show Gist options
  • Save hjazz/7671724 to your computer and use it in GitHub Desktop.
Save hjazz/7671724 to your computer and use it in GitHub Desktop.
adopt GaussianBlur Fiilter to UIImage
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