Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; public class Main { /** * Bitmap to Data * @param src Bitmap * @param format Bitmap.CompressFormat * @param quality int * @return byte[] */ public static byte[] chngBmpToData(Bitmap src, Bitmap.CompressFormat format, int quality) { ByteArrayOutputStream output = new ByteArrayOutputStream(); src.compress(format, quality, output); return output.toByteArray(); } }