List of usage examples for android.graphics BitmapFactory decodeFile
public static Bitmap decodeFile(String pathName, Options opts)
From source file:Main.java
public static double[] getImageWidthAndHeight(String path) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*from www .j a va 2 s . co m*/ BitmapFactory.decodeFile(path, options); double imageWidth = options.outWidth; double imageHeight = options.outHeight; return new double[] { imageWidth, imageHeight }; }
From source file:Main.java
public static Bitmap decodeFile(String filename, int inSampleSize) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = inSampleSize; return BitmapFactory.decodeFile(filename, options); }
From source file:Main.java
public static int getSampleSizeAdjustToScreen(String filePath, int[] screenSize) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*from w w w . ja v a2 s. c o m*/ BitmapFactory.decodeFile(filePath, options); int w = (int) Math.ceil(options.outWidth / (float) screenSize[0]); int h = (int) Math.ceil(options.outHeight / (float) screenSize[1]); if (h > 1 || w > 1) { if (h > w) { options.inSampleSize = h; } else { options.inSampleSize = w; } } return options.inSampleSize; }
From source file:Main.java
public static Bitmap decodeFile(String path) { Bitmap bm;/*w ww. ja va2 s. co m*/ BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inJustDecodeBounds = true; BitmapFactory.decodeFile(path, opt); final int size = 1024; int scale = 1; while (opt.outWidth / scale >= size || opt.outHeight / scale >= size) { scale *= 2; } opt.inSampleSize = scale; opt.inJustDecodeBounds = false; bm = BitmapFactory.decodeFile(path, opt); return bm; }
From source file:Main.java
public static Bitmap getBitmapFromPath(String path) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; return BitmapFactory.decodeFile(path, options); }
From source file:Main.java
public static int[] getSize(File bitmapFile) { int[] hw = new int[] { 0, 0 }; BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true;//from w ww . j ava 2s .c om BitmapFactory.decodeFile(bitmapFile.getPath(), opts); hw[0] = opts.outWidth; hw[1] = opts.outHeight; return hw; }
From source file:Main.java
public static Bitmap getBoundsBitmap(String filePath) { Options opts = new Options(); opts.inJustDecodeBounds = true;//from w ww . j a v a 2 s. c om return BitmapFactory.decodeFile(filePath, opts); }
From source file:Main.java
public final static Options getBitmapOptions(String srcPath) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;//www .j av a2 s .c o m BitmapFactory.decodeFile(srcPath, options); return options; }
From source file:Main.java
public static boolean isLowResolution(final String path) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*from w w w . ja va2 s . c o m*/ BitmapFactory.decodeFile(path, options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; return imageHeight < MIN_RES || imageWidth < MIN_RES; }
From source file:Main.java
public static BitmapFactory.Options getBitmapDims(String path) throws Exception { BitmapFactory.Options bfo = new BitmapFactory.Options(); bfo.inJustDecodeBounds = true;/*from w w w . j av a 2s . com*/ BitmapFactory.decodeFile(path, bfo); return bfo; }