자바에서 비트맵을 byte배열로 변환
조회수 3160회
Bitmap bmp = intent.getExtras().get("data");
int size = bmp.getRowBytes() * bmp.getHeight();
ByteBuffer b = ByteBuffer.allocate(size);
bmp.copyPixelsToBuffer(b);
byte[] bytes = new byte[size];
try {
b.get(bytes, 0, bytes.length);
} catch (BufferUnderflowException e) {
//예외 처리
}
// byte[]처리
이코드의 뭐가 잘못된건가요? 왜 동작을 안하죠?
댓글 입력