Converter to blur an UIImage in Xamarin iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UIKit; | |
using CoreImage; | |
namespace iOS | |
{ | |
public static class UIImageConverter | |
{ | |
public static UIImage Blur(UIImage image) | |
{ | |
var ciImage = new CIImage(image); | |
var gaussian_blur = new CIGaussianBlur() | |
{ | |
Image = ciImage, | |
Radius = 5f, | |
}; | |
var output = gaussian_blur.OutputImage; | |
var context = CIContext.FromOptions(null); | |
var cgImage = context.CreateCGImage(output, output.Extent); | |
return UIImage.FromImage(cgImage); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment