Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.InputStream; public class Main { @SuppressWarnings("unused") private static Bitmap getBitmap(InputStream fs) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = 1; Bitmap imgBitmap = BitmapFactory.decodeStream(fs, null, opts); if (imgBitmap != null) { int width = imgBitmap.getWidth(); int height = imgBitmap.getHeight(); imgBitmap = Bitmap.createScaledBitmap(imgBitmap, width, height, true); } return imgBitmap; } }