Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bitmap blur util for Xamarin Android
using Android.App;
using Android.Support.V8.Renderscript;
namespace Droid
public static class BitmapUtil
public static Bitmap Blur(Bitmap originalBitmap)
// Create the Renderscript instance that will do the work.
RenderScript rs = RenderScript.Create(Application.Context);
// Allocate memory for Renderscript to work with
Allocation input = Allocation.CreateFromBitmap(rs, originalBitmap, Allocation.MipmapControl.MipmapFull, (int)Renderscripts.AllocationUsage.Script);
Allocation output = Allocation.CreateTyped(rs, input.Type);
// Load up an instance of the specific script that we want to use.
ScriptIntrinsicBlur script = ScriptIntrinsicBlur.Create(rs, Element.U8_4(rs));
// Set the blur radius
// Start the ScriptIntrinisicBlur
// Copy the output to the blurred bitmap
return originalBitmap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment