List of utility methods to do Bitmap Thumbnail Create
Bitmap | getImageThumbnail(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; ... |
Bitmap | extractThumbnail(Bitmap source, int width, int height) Creates a centered bitmap of the desired size. return extractThumbnail(source, width, height, OPTIONS_NONE);
|
Bitmap | extractThumbnail(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(); ... |
void | cacheAvatar(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)); |