List of utility methods to do Bitmap Size Get
int[] | obtainBitmapSize(String pathName) obtain Bitmap Size int[] size = new int[2]; final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(pathName, options); size[0] = options.outWidth; size[1] = options.outHeight; return size; |
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 | computeInitialSampleSize( BitmapFactory.Options options, int minSideLength, int maxNumOfPixels) compute Initial Sample Size double w = options.outWidth; double h = options.outHeight; int lowerBound = (maxNumOfPixels == -1) ? 1 : (int) Math.ceil(Math .sqrt(w * h / maxNumOfPixels)); int upperBound = (minSideLength == -1) ? 128 : (int) Math.min( Math.floor(w / minSideLength), Math.floor(h / minSideLength)); if (upperBound < lowerBound) { ... |
int | computeInitialSampleSize(int w, int h, int minSideLength, int maxNumOfPixels) compute Initial Sample Size if (maxNumOfPixels == UNCONSTRAINED && minSideLength == UNCONSTRAINED) return 1; int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 : (int) Math .ceil(Math.sqrt((double) (w * h) / maxNumOfPixels)); if (minSideLength == UNCONSTRAINED) { return lowerBound; } else { ... |
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 | computeInSampleSizeForMoment(Bitmap map, int newWidth, int newHeight) compute In Sample Size For Moment int width = map.getWidth(); int height = map.getHeight(); int inSampleSize = 1; if (width < newWidth && height < newHeight) { } else { float widthRadio = width / newWidth; float heightRadio = height / newHeight; inSampleSize = (int) Math.max(widthRadio, heightRadio); ... |
int | computeSampleSize(int width, int height, int minSideLength, int maxNumOfPixels) Compute the sample size as a function of minSideLength and maxNumOfPixels. int initialSize = computeInitialSampleSize(width, height, minSideLength, maxNumOfPixels); return initialSize <= 8 ? nextPowerOf2(initialSize) : (initialSize + 7) / 8 * 8; |
int | computeSampleSize(float scale) compute Sample Size assertTrue(scale > 0); int initialSize = Math.max(1, (int) Math.ceil(1 / scale)); return initialSize <= 8 ? nextPowerOf2(initialSize) : (initialSize + 7) / 8 * 8; |
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 | computeSampleSizeLarger(int w, int h, int minSideLength) compute Sample Size Larger int initialSize = Math.max(w / minSideLength, h / minSideLength); if (initialSize <= 1) return 1; return initialSize <= 8 ? prevPowerOf2(initialSize) : initialSize / 8 * 8; |