List of usage examples for android.graphics BitmapFactory decodeFile
public static Bitmap decodeFile(String pathName, Options opts)
From source file:Main.java
public static Bitmap getSmallBitmap(String filePath) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/* ww w . j a va 2s. c om*/ BitmapFactory.decodeFile(filePath, options); options.inSampleSize = calculateInSampleSize(options, 480, 320); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
From source file:Main.java
public static void getFullBitmapBounds(String file, int[] r) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;// www . j a v a 2 s .co m options.inPreferredConfig = Bitmap.Config.ALPHA_8; BitmapFactory.decodeFile(file, options); r[0] = options.outWidth; r[1] = options.outHeight; }
From source file:Main.java
public static Bitmap getScaleBitmap(Context context, String filePath) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true;/* w w w . j a v a 2 s . c om*/ Bitmap bitmap = BitmapFactory.decodeFile(filePath, opts); opts.inJustDecodeBounds = false; int ratio = (int) (opts.outHeight / (float) 200); if (ratio <= 0) ratio = 1; opts.inSampleSize = ratio; bitmap = BitmapFactory.decodeFile(filePath, opts); return bitmap; }
From source file:Main.java
public static Bitmap obtainPreviewMap(String path, int sample) { Options opts = new Options(); opts.inSampleSize = sample;// w ww . j ava 2 s . c o m return BitmapFactory.decodeFile(path, opts); }
From source file:Main.java
public static Bitmap createBitmapSample(String path, int sampleSize) { BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inSampleSize = sampleSize; return BitmapFactory.decodeFile(path, bitmapOptions); }
From source file:Main.java
public static Bitmap getCompressedBitmap(String str) { Options options = new Options(); options.inJustDecodeBounds = true;/*from w w w.j av a 2 s .c o m*/ BitmapFactory.decodeFile(str, options); options.inSampleSize = calculateInSampleSize(options, options.outWidth, options.outHeight); options.inJustDecodeBounds = false; options.inPreferredConfig = Config.RGB_565; options.inDither = true; return BitmapFactory.decodeFile(str, options); }
From source file:Main.java
public static Bitmap decodeBitmapFromPath(String path, int reqWidth, int reqHeight) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*www .ja v a 2s. c o m*/ BitmapFactory.decodeFile(path, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(path, options); }
From source file:Main.java
public static BitmapFactory.Options getBitmapDecodeOptions(String imagePath, int outWidth, int outHeight) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*from www . ja v a 2s . c om*/ BitmapFactory.decodeFile(imagePath, options); options.inSampleSize = calculateSampleSize(options, outWidth, outHeight); options.inJustDecodeBounds = false; return options; }
From source file:Main.java
public static Bitmap getSmallBitmap(String filePath, int reqWidth, int reqHeight) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;//from www. ja v a2s.c o m BitmapFactory.decodeFile(filePath, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
From source file:Main.java
public static Bitmap decodeBitmapFromFile(String pathName, BitmapFactory.Options opts) { if (TextUtils.isEmpty(pathName)) { return null; }/*from w w w . j ava 2s . c o m*/ return BitmapFactory.decodeFile(pathName, opts); }