Last active
May 13, 2016 13:25
-
-
Save BrunoVT1992/5efb0e0b32ef5e98ed8d3f4abd82cf56 to your computer and use it in GitHub Desktop.
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