Android Utililty Methods Bitmap Thumbnail Create

List of utility methods to do Bitmap Thumbnail Create

Description

The list of methods to do Bitmap Thumbnail Create are organized into topic(s).

Method

BitmapgetImageThumbnail(String imagePath, int width, int height)
get Image Thumbnail
Bitmap bitmap = null;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
bitmap = BitmapFactory.decodeFile(imagePath, options);
options.inJustDecodeBounds = false;
int h = options.outHeight;
int w = options.outWidth;
int beWidth = w / width;
...
BitmapextractThumbnail(Bitmap source, int width, int height)
Creates a centered bitmap of the desired size.
return extractThumbnail(source, width, height, OPTIONS_NONE);
BitmapextractThumbnail(Bitmap source, int width, int height, int options)
Creates a centered bitmap of the desired size.
if (source == null) {
    return null;
float scale;
if (source.getWidth() < source.getHeight()) {
    scale = width / (float) source.getWidth();
} else {
    scale = height / (float) source.getHeight();
...
voidcacheAvatar(Context context, URI uri, Bitmap avatar)
cache Avatar
try {
    avatar.compress(CompressFormat.PNG, 0, context.openFileOutput(
            String.format("%d.bmp", uri.hashCode()),
            Context.MODE_PRIVATE));
} catch (IOException ex) {
    Log.e(TAG, String.format("error caching %s", uri));