0

I am making some kind of image filter, and I need to desaturate (remove saturation) for a specific color. For example red. I want my image to replace all red colors with gray.
Change this image enter image description here

To this enter image description here

Any idea?

filipst
  • 1,547
  • 1
  • 30
  • 55

2 Answers2

0

It's say there http://developer.android.com/reference/android/graphics/ColorMatrixColorFilter.html that ColorMatrixColorFilter can be used to change saturation of pixel. But you have to play with math and ColorMatrix

Is that what you're researching ?

Edit : There is not such thing in Android standard library. Filter are written in NDK for performance issue, so you'll need to do the same for a custom filter.

Another idea without thinking of performance is : loop through all pixels and desaturate when it's "red"

Will Bobo
  • 408
  • 4
  • 11
0

I think you can use OR login to add a "filter" to your color RGB or ARGB

int filter = 0x00CC0000 | color;
myView.setBackgroundColor(filter);
heloisasim
  • 4,956
  • 2
  • 27
  • 36