Here you can find the source of computeSampleSize(BitmapFactory.Options options, int target)
public static int computeSampleSize(BitmapFactory.Options options, int target)
//package com.java2s; import android.graphics.BitmapFactory; public class Main { public static int computeSampleSize(BitmapFactory.Options options, int target) { int w = options.outWidth; int h = options.outHeight; float candidateW = w / target; float candidateH = h / target; float candidate = Math.max(candidateW, candidateH); candidate = (float) (candidate + 0.0); if (candidate <= 1.0) return 1; return (int) candidate; }/* w w w.j av a2s . c o m*/ }