Blurry icon indicating copy to clipboard operation
Blurry copied to clipboard

Get direct Bitmap output

Open noyize opened this issue 5 years ago • 4 comments

Is there a way to get the output as bitmap, rather than setting it directly to the ImageView.

noyize avatar Jul 19 '19 18:07 noyize

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
        })

andj207 avatar Dec 27 '19 14:12 andj207

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);

memishood avatar Feb 21 '20 02:02 memishood

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.

romanbsd avatar Oct 06 '20 09:10 romanbsd

Or at leat BitmapComposer should have a method to get the blurred bitmap.

bes89 avatar Mar 26 '21 17:03 bes89