Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.IOException; import android.graphics.Bitmap; public class Main { private static byte[] readBitmap(Bitmap bmp) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 60, baos); try { baos.flush(); baos.close(); } catch (IOException e) { e.printStackTrace(); } return baos.toByteArray(); } }