BlurEffectForAndroidDesign
BlurEffectForAndroidDesign copied to clipboard
Blurring downloaded image
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!!
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:
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
ths ,@devflow