Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; public class Main { public static InputStream getBitmapPngStream(Bitmap theBitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); theBitmap.compress(Bitmap.CompressFormat.PNG, 95, baos); byte[] data = baos.toByteArray(); return new ByteArrayInputStream(data); } }