Reputation: 9429
I want to draw a bitmap, but with only gray pixel (for example 0x555555 color).
So I should change all the colorful pixel's color to gray.
How to do this or how to draw an image with only grayed pixels?
Upvotes: 0
Views: 395
Reputation: 46943
What you are looking for is called "converting image to grayscale in English". Making a simple search I found the following thread (luckily it targets exactly Android. Hopefully it will help you.
Upvotes: 1
Reputation: 3666
You can read every pixel, convert it to RGB color system. Then if you want grey, then Red, Green and Blue must have equal value.
I don't know exactly what is best, when you get the good "gray" color. But maybe if you do this math: (Red + Green + Blue) / 3 = x Color R = x, G = x, B = x; Then they all got the same color, but I don't know if yo get a correct gray scale with this.
If you need more information, just say it, I got some code how to read pixels from a bitmap and convert them into RGB color system.
Upvotes: 0