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 getBitmapJpegStream(Bitmap theBitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); theBitmap.compress(Bitmap.CompressFormat.JPEG, 95, baos); byte[] data = baos.toByteArray(); return new ByteArrayInputStream(data); } }