Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; import java.io.IOException; public class Main { /** * BitMap2Byte * * @param bitmap * @return */ public static byte[] getBitmapByte(Bitmap bitmap) { ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); try { out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } return out.toByteArray(); } }