Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import java.io.ByteArrayOutputStream; public class Main { public final static byte[] BitmapChangeByte(Bitmap btm) { if (btm == null) { return null; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); btm.compress(CompressFormat.PNG, 100, baos); byte[] data2 = baos.toByteArray(); return data2; } }