skip to Main Content

I want to do a function like photoshop’s average blur (Filter>Blue>Average)

but I tried something like get average color from image in android,
but really buggy. most image turn out to be black or gray or white.

any lib available? or Is there any app can do this?

the effect just like this.

GOAL:

3

Answers


  1. you can use this library to make blur any background or image https://github.com/faradaj/BlurBehind

    Login or Signup to reply.
  2. An interesting question. And the answer is not a straight forward one.

    1. Looking around I’ve found this article: How does photoshop calculate the "average blur" (average color) of an image?
    2. Which points to this article, which has code: http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata
    3. This shouldn’t be hard to implement on Android.
    4. However, I do suggest you do not implement this in Java, which is very slow. Rather do this on RenderScript, which is a Google technology designed for this type of missions – a cross architecture, highly optimized C code to handle graphic tasks and image manipulation.
    Login or Signup to reply.
  3. If you don’t like the color you are getting from the average of the color values, you could try Android’s Palette class. The class was made to generate a palette of colors based on the prominent colors of an image to create something like this:

    enter image description here

    This would have to be done asynchronously from the UI thread:

    Palette.from(bitmap).generate(new PaletteAsyncListener() {
        public void onGenerated(Palette palette) {
            // Use generated palette
        }
    });
    

    You can try the different methods available from the Palette class (i.e. getVibrantColor, getMutedColor, getDarkVibrantColor, etc.) to see which returns values you like.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search