-(UIImage*)convertToBlurImage:(UIImage*)image{// create input imageCIImage*inputImage=[CIImageimageWithCGImage:[imageCGImage]];// create filterCIFilter*gaussianBlurFilter=[CIFilterfilterWithName:@"CIGaussianBlur"];// set filter parameters[gaussianBlurFiltersetDefaults];[gaussianBlurFiltersetValue:inputImageforKey:kCIInputImageKey];[gaussianBlurFiltersetValue:@6forKey:kCIInputRadiusKey];// create output imageCIImage*outputImage=[gaussianBlurFilteroutputImage];CIContext*context=[CIContextcontextWithOptions:nil];CGImageRefcgimg=[contextcreateCGImage:outputImagefromRect:[inputImageextent]];// get UIImageUIImage*convertedImage=[UIImageimageWithCGImage:cgimg];returnconvertedImage;}
UIView to UIImage
123456789
-(UIImage*)imageFromUIView:(UIView*)view{UIGraphicsBeginImageContextWithOptions(view.bounds.size,YES,0.0);// render view in context[view.layerrenderInContext:UIGraphicsGetCurrentContext()];// get image from contextUIImage*image=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();returnimage;}