Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; public class Main { public static byte[] getBitmapInBytes(Bitmap b) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); b.compress(Bitmap.CompressFormat.JPEG, 50, stream); return stream.toByteArray(); } }