Android 将位图图像更改为像素数组
我必须通过android来改变它,就像在java中一样Android 将位图图像更改为像素数组,android,Android,我必须通过android来改变它,就像在java中一样 byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); 这里的图像是BuffereImage,但是 int[] pixels; image.getPixels(pixels, 0, width, 0, 0, width , height ); 这里的imgae是位图图像 返回像素值而不是java。像这样尝试 Bitmap bmp
byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
这里的图像是BuffereImage,但是
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();
试着这样,
Bitmap bmp = intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
int width=bitmap.getWidth;int height=bitmap.getHeight;int[]像素=新int[宽度*高度];bitmap.getPixels像素,0,宽度,0,0,宽度,高度//尝试使用Hiren-Daphi行。它在android中也能工作。+1到Hirenth这个问题已经解决了,比如int[]pix1=new int[w*h];image.getPixelspix1,0,w,0,0,w,h;像素=新字节[pix1.length*3];对于int i=0;i