Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.File; public class Main { private static final int KILOBYTES = 16 * 1024; private static final int SAMPLE_SIZE = 2; /** * Get Bitmap from file * * @param imageFile - Image file * @return Generated Bitmap */ public static Bitmap getBitmapFromFile(File imageFile) { BitmapFactory.Options bitmapDecodeOptions = new BitmapFactory.Options(); bitmapDecodeOptions.inTempStorage = new byte[KILOBYTES]; bitmapDecodeOptions.inSampleSize = SAMPLE_SIZE; return BitmapFactory.decodeFile(imageFile.getAbsolutePath(), bitmapDecodeOptions); } }