Android SDK中提供了Bitmap图片每个像素颜色读取的方法:

1
2
3
4
5
6
7
8
9
Bitmap src =  BitmapFactory.decodeResource(getResources(),R.drawable.imgbg);
int height = src.getHeight();
int width = src.getWidth();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pixelColor = src.getPixel(x, y); // 颜色值
int A = Color.alpha(pixelColor); // A R G B
}
}