Skip to content

Instantly share code, notes, and snippets.

@pwittchen
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwittchen/9171526 to your computer and use it in GitHub Desktop.
Save pwittchen/9171526 to your computer and use it in GitHub Desktop.
Decode sampled bitmap from file path.
public static Bitmap decodeSampledBitmap(String filePath, int reqWidth, int reqHeight) {
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath,options);
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filePath,options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment