Android examples for Graphics:Bitmap Stream
Read Bitmap from Stream
//package com.java2s; import java.io.InputStream; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Rect; public class Main { public static Bitmap ReadBitMap(InputStream in, int width, int height) { BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inJustDecodeBounds = true;//w w w . j a v a 2s .co m opt.inSampleSize = 4; // ????????? return BitmapFactory.decodeStream(in, new Rect(0, height / 2, width + 0, height), opt); } }