Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

image - How do you get the RGB values from a Bitmap on an Android device?

I want to get RGB values of bitmap in android but I cant do this so far. My aim is to obtain RGB values for each pixel of bitmap. Is there any specific function for android or anything else ?? Also I wonder that do I need colorMatrix() function? It is very important for my project. Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Bitmap.getPixel(x, y) returns an int with the colour values and alpha value embedded into it.

int colour = bitmap.getPixel(x, y);

int red = Color.red(colour);
int blue = Color.blue(colour);
int green = Color.green(colour);
int alpha = Color.alpha(colour);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...