4
안드로이드에서 Bitmap.CompressFormat 클래스없이 비트 맵을 바이트 배열로 변환하는 방법이 있습니까? 그렇지 않다면 어떻게 될까요? 가능한 경우 알려주세요. 고맙습니다.비트 맵을 Byte 배열로 변환하지 않고 Bitmap.CompressFormat
안드로이드에서 Bitmap.CompressFormat 클래스없이 비트 맵을 바이트 배열로 변환하는 방법이 있습니까? 그렇지 않다면 어떻게 될까요? 가능한 경우 알려주세요. 고맙습니다.비트 맵을 Byte 배열로 변환하지 않고 Bitmap.CompressFormat
다음과 같은 것이 있습니까?
//b is the Bitmap
//calculate how many bytes our image consists of.
int bytes = b.getByteCount();
//or we can calculate bytes this way. Use a different value than 4 if you don't use 32bit images.
//int bytes = b.getWidth()*b.getHeight()*4;
ByteBuffer buffer = ByteBuffer.allocate(bytes); //Create a new buffer
b.copyPixelsToBuffer(buffer); //Move the byte data to the buffer
byte[] array = buffer.array(); //Get the underlying array containing the data.
Bitmap.CompressFormat을 사용하지 않고이 배열을 jpg로 저장할 수 있습니까? @ 스탄 판 – Julie