Currently in an Android application that I'm developing I'm looping through the pixels of an image to blur it. This takes about 30 seconds on a 640x480 image.
While browsing apps in the Android Market I came across one that includes a blur feature and their blur is very fast (like 5 seconds) so they must be using a different method of blurring.
Anyone know a faster way other than looping through the pixels?
I found that decreasing contrast, brightness and saturation a little makes blurred images more pretty so I combined various methods from stack overflow and made this Blur Class which deals with blurring images, changing brightness, saturation, contrast and size of the blurred images. It can also convert images from drawable to bitmap and vice-versa.
I used this before..
This is a shot in the dark, but you might try shrinking the image and then enlarging it again. This can be done with
Bitmap.createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter)
. Make sure and set the filter parameter to true. It'll run in native code so it might be faster.For future Googlers, here is an algorithm that I ported from Quasimondo. It's kind of a mix between a box blur and a gaussian blur, it's very pretty and quite fast too:
Use Render Script as mentioned here http://blog.neteril.org/blog/2013/08/12/blurring-images-on-android/
Here is a realtime blurring overlay using RenderScript, which seems to be fast enough.
https://github.com/mmin18/RealtimeBlurView