Blurry
Blurry copied to clipboard
Get direct Bitmap output
Is there a way to get the output as bitmap, rather than setting it directly to the ImageView.
For anyone is finding this feature. We can get direct bitmap like this:
val bitmap = Blur.of(context, sourceBitmap, BlurFactor().apply {
sampling = downSampling
radius = blurRadius
color = colorOverlay
})
I invastigated the source code, i think it will not work without setting width and height.
BlurFactor factor = new BlurFactor();
factor.width = yourBitmap.getWidth();
factor.height = yourBitmap.getHeight();
//bitmap
Bitmap bitmap = Blur.of(context, yourBitmap, factor);
//drawable
Drawable drawable = new BitmapDrawable(getResources(), bitmap);
Unfortunately version 4.0.0 of blurry made the Blur and BlurFactor classes package private. I think that they should be part of public API, as we also use them this way to transform bitmaps w/o underlying ImageView.
Or at leat BitmapComposer
should have a method to get the blurred bitmap.