A light blur effect?

2019-08-07 16:57发布

问题:

I would like to get a light blur effect , in which you still can somehow recognise the image, or even adjust it .

I used to have the Apple one :

UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
alphaView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];

Which is not really "light" , but is very strong so you cant see the image anymore.

I would rather not using external 3rd classes, because from my experience they turned to be problematic.

I also remember Apple used to have a class called : UIIMAGE+BLUR, before the UIVisualEffectView which let you adjust things. Is it still valid and acceptable by the App Store ?

回答1:

There's two other options I know of.

One is to use the Accelerate framework and do it manually (I think this is the UIIMAGE+BLUE you refer to): https://developer.apple.com/library/ios/samplecode/UIImageEffects/Introduction/Intro.html

The easier option is to use CoreImage's Gaussian Blur. There's some sample code in the Question here: CIGaussianBlur image size