使用之前导入CoreGraphics CoreImage 库
再.m文件中写头文件<Accelerate/Accelerate.h>
//参数1:需要处理的图片
//参数2:模糊度
返回UIImage类型
-(UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur
{
CIImage *inputImage = [CIImage imageWithCGImage:image.CGImage];
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"
keysAndValues:kCIInputImageKey, inputImage,
@"inputRadius", @(blur), nil];
CIImage *outputImage = filter.outputImage;
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef outImage = [context createCGImage:outputImage fromRect:[outputImage extent]];
return [UIImage imageWithCGImage:outImage];
}