Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import java.nio.ByteBuffer; public class Main { /** * Converts bitmap to the byte array without compression * @param bitmap source bitmap * @return result byte array */ public static byte[] convertBitmapToByteArrayUncompressed(Bitmap bitmap) { ByteBuffer byteBuffer = ByteBuffer.allocate(bitmap.getByteCount()); bitmap.copyPixelsToBuffer(byteBuffer); byteBuffer.rewind(); return byteBuffer.array(); } }