Here you can find the source of decodeSampledBitmapFromData(byte[] data)
public static Bitmap decodeSampledBitmapFromData(byte[] data)
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { public static Bitmap decodeSampledBitmapFromData(byte[] data) { // First decode with inJustDecodeBounds=true to check dimensions final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(data, 0, data.length, options); options.inSampleSize = 1; // saved image will be one half the width and options.inJustDecodeBounds = false; return BitmapFactory.decodeByteArray(data, 0, data.length, options); }// ww w . ja v a 2s .c o m }