Android examples for android.graphics:Bitmap Load Save
decode Sampled Bitmap From Data
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;/* w w w . j a v a2s . c o m*/ BitmapFactory.decodeByteArray(data, 0, data.length, options); options.inSampleSize = 1; // saved image will be one half the width and // height of the original (image captured is // double the resolution of the screen size) // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; return BitmapFactory.decodeByteArray(data, 0, data.length, options); } }