Here you can find the source of bitmapToBytes(Bitmap bm)
public static byte[] bitmapToBytes(Bitmap bm)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; public class Main { public static byte[] bitmapToBytes(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); }/*from www .ja va 2 s. c om*/ }