2013-06-10 3 views

ответ

1

Что-то вроде этого?

//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. 

От; https://stackoverflow.com/a/10192092/1868384

+0

Можно ли сохранить этот массив как jpg без использования Bitmap.CompressFormat? @Stephan – Julie

Смежные вопросы