How do you get the RGB values from a Bitmap on Android?

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 green = Color.green(colour);
int blue = Color.blue(colour);
int alpha = Color.alpha(colour);

Leave a Comment