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