BlurEffectForAndroidDesign icon indicating copy to clipboard operation
BlurEffectForAndroidDesign copied to clipboard

Blurring downloaded image

Open ksy5662 opened this issue 10 years ago • 3 comments

Dear PomepuyN,

Thanks for your great sample!!

I am trying to add picasso image loader to download any image from flickr. But seems it is not working with picasso.

Picasso.with(this.getApplicationContext()).load("http://farm8.staticflickr.com/7195/6980356584_874a4e6346_z.jpg").into(mNormalImage);

Better to share any sample to blurring downloaded images.

Happy New Year!!

ksy5662 avatar Dec 29 '14 06:12 ksy5662

I tried many times to blur image downloaded from internet by use your Blur.fastblur() method, but failed. There is no any error logged, maybe renderscript problem? Later I use your method to decode a picture in local by use BitmapFactory.decodeResource(), that's will be success, rendersript worked well, but when you try blur download bitmap, that's will always be failed, I don't know why, I use Volley's ImageLoader to get bitmap from internet, when picture fetched, there will be a bitmap returned, then you use this bitmap to blur, failed with no luck.


I FIGURED OUT WHAT CAUSED THIS!!!!

Volley's ImageLoader return bitmap with Bitmap.Config.ARGB_565, but RenderScript expected Bitmap.ARGB_8888, so that's reason why your renderscript blur method crashed.

Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);

maybe you can add some error handle when passed a bitmap is Bitmap.Config.ARGB_565 :100:

chenjishi avatar Mar 18 '15 08:03 chenjishi

You can blurring downloaded image with picasso.

Picasso.with(getContext()).load("image").transform(new Transformation() {
                    @Override
                    public Bitmap transform(Bitmap bitmap) {
                        Bitmap b = Blur.fastblur(getContext(), bitmap, 13);
                        bitmap.recycle();
                        return b;
                    }

                    @Override
                    public String key() {
                        return "blur";
                    }
                }).into(image);

NOTE: Do Not config bitmap to RGB_565

devflow avatar Jun 30 '15 03:06 devflow

ths ,@devflow

yanxinmiao avatar Apr 27 '16 09:04 yanxinmiao