我使用CIFilter Gaussian Blur
来模糊UIImage。图像变得模糊但边缘变得更加模糊。我希望图像同样模糊。以下是输出:
我不希望图像上出现多余的白线。以下是我正在使用的代码:
- (UIImage *)setupBlurredImage:(UIImage *)image
{
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [[CIImage alloc] initWithImage:image];
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
[filter setValue:inputImage forKey:kCIInputImageKey];
[filter setValue:[NSNumber numberWithFloat:5.0f] forKey:@"inputRadius"];
CIImage *result = [filter valueForKey:kCIOutputImageKey];
CIFilter *affineClampFilter = [CIFilter filterWithName:@"CIAffineClamp"];
CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]];
UIImage *blurimage=[UIImage imageWithCGImage:cgImage];
//add our blurred image to the scrollview
return blurimage;
}
我尝试了here给出的所有技巧。没有人为我工作。
我哪里出错了?我该如何解决这个问题?