Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; public class Main { public static InputStream getInputStreamFromBitmap(Bitmap bitmap) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); final byte[] bitmapdata = out.toByteArray(); final ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata); return bs; } }