java - Applying blur using RenderScript in Android creates weird output -
i'm attempting apply blur image using renderscript class. here code use (where this.image original bitmap)
bitmap inputimage = this.image; int height = inputimage.getheight(); int width = inputimage.getwidth(); bitmap blurredimage = bitmap.createbitmap(width, height, bitmap.config.argb_8888); renderscript rs = renderscript.create(context); scriptintrinsicblur theintrinsic = scriptintrinsicblur.create(rs, element.u8_4(rs)); allocation tmpin = allocation.createfrombitmap(rs, inputimage); allocation tmpout = allocation.createfrombitmap(rs, blurredimage); theintrinsic.setradius(25.f); theintrinsic.setinput(tmpin); theintrinsic.foreach(tmpout); tmpout.copyto(blurredimage); this.image = blurredimage; return true;
this input , output function http://imgur.com/a/ewjv6
for reason, appears double image , keep green channel or something. fidling around blur radius doesn't work, , can't find wrong code (which copied working example)
i had same error , found out causing it, know it's question 2 years ago still ones come same problem.
the problem images i've been using rgb_565 formatted , because renderscript blurring not getting enough specifications rgb_565 images results outputs this.
i using universalimageloader rgb_565 configuration reduce memory usage , having blur effect when necessary on downloaded images, , when remove configuration use default argb_8888 format, fine!
sum up: don't use rgb_565 while having renderscript blur, use argb_8888 instead.
Comments
Post a Comment