Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; public class Main { public static ByteArrayOutputStream getBitmapOutputStream(Bitmap b) { Bitmap immagex = b; ByteArrayOutputStream baos = new ByteArrayOutputStream(); immagex.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos; } }