原因:Android有自己的图像包
代码:
//以文件流的方式读取图片
FileInputStream fis = new FileInputStream("/sdcard/test.png");
Bitmap bitmap = BitmapFactory.decodeStream(fis);
picture.setImageBitmap(bitmap);
int height = bitmap.getHeight();//图片的高度
int width = bitmap.getWidth();//图片的宽度
int pixel;
for(int i=0; i<width; i++)//可自行更改起点位置
for(int j=0; j<height; j++)
{
pixel = bitmap.getPixel(i, j);//下面三行获取像素点(i, j)的RGB值
rgbR = (pixel & 0xff0000) >> 16;
rgbG = (pixel & 0xff00) >> 8;
rgbB = (pixel & 0xff);
System.out.println("i=" + i + ",j=" + j + ":(" + rgbR + "," + rgbG + "," + rgbB + ")" );
}
如果对你有用的话就点个赞吧,感谢
来源:CSDN
作者:qq_28746225
链接:https://blog.csdn.net/qq_28746225/article/details/104576053