我必须像在 java 中一样通过 android 更改它
byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
(这里的图片是BufferedImage),但是
int[] pixels;
image.getPixels(pixels, 0, width, 0, 0, width , height );
(这里imgae是位图图片) 返回像素值而不是 java。
最佳答案
这样试试,
Bitmap bmp = intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
关于android - 将位图图像更改为像素数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9079440/