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 getInputStreamValue(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); InputStream in = new ByteArrayInputStream(stream.toByteArray()); return in; } }