Here you can find the source of getBytes(Bitmap bm)
public static byte[] getBytes(Bitmap bm)
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; public class Main { public static byte[] getBytes(Bitmap bm) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); return byteArray; }// www .j a v a 2 s.c om }