List of utility methods to do Bitmap Size Get
int | computeSampleSizeLarger(float scale) compute Sample Size Larger int initialSize = (int) Math.floor(1f / scale); if (initialSize <= 1) return 1; return initialSize <= 8 ? prevPowerOf2(initialSize) : initialSize / 8 * 8; |
int | getBitmapSize(Bitmap bitmap) Get the size in bytes of a bitmap in a BitmapDrawable. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); return bitmap.getRowBytes() * bitmap.getHeight(); |
int | calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) calculate In Sample Size final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { if (width > height) { inSampleSize = Math.round((float) height / (float) reqHeight); } else { ... |
int | calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) calculate In Sample Size final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { final int heightRatio = Math.round((float) height / (float) reqHeight); final int widthRatio = Math.round((float) width / (float) reqWidth); ... |
int | computeInitialSampleSize( BitmapFactory.Options options, int minSideLength, int maxNumOfPixels) compute Initial Sample Size double w = options.outWidth; double h = options.outHeight; int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 : (int) Math .ceil(Math.sqrt(w * h / maxNumOfPixels)); int upperBound = (minSideLength == UNCONSTRAINED) ? 128 : (int) Math.min(Math.floor(w / minSideLength), Math.floor(h / minSideLength)); if (upperBound < lowerBound) { ... |
int | computeSampleSize(BitmapFactory.Options options, int minSideLength, int maxNumOfPixels) compute Sample Size int initialSize = computeInitialSampleSize(options, minSideLength, maxNumOfPixels); int roundedSize; if (initialSize <= 8) { roundedSize = 1; while (roundedSize < initialSize) { roundedSize <<= 1; } else { roundedSize = (initialSize + 7) / 8 * 8; return roundedSize; |
int | getBitmapSize(Bitmap bitmap) get Bitmap Size return bitmap.getRowBytes() * bitmap.getHeight();
|
BitmapFactory.Options | getBitmapSize(String strImagePath) get Bitmap Size BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(strImagePath, options); return options; |
BitmapFactory.Options | getBitmapSize(String strImagePath, boolean checkOrientation) get Bitmap Size BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(strImagePath, options); if (checkOrientation) { int degree = getExifDegree(strImagePath); if (degree == 90 || degree == 270) { int temp = options.outWidth; options.outWidth = options.outHeight; ... |