List of usage examples for android.graphics BitmapFactory decodeStream
@Nullable public static Bitmap decodeStream(@Nullable InputStream is, @Nullable Rect outPadding, @Nullable Options opts)
From source file:Main.java
public static Bitmap getBitmapByOptions(InputStream is, BitmapFactory.Options options) { Bitmap bitmap = BitmapFactory.decodeStream(is, null, options); return bitmap; }
From source file:Main.java
public static BitmapFactory.Options getImageOptions(InputStream in) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true;/*from w ww. j a va2s . c o m*/ BitmapFactory.decodeStream(in, null, opts); return opts; }
From source file:Main.java
public static int[] measureSize(InputStream is) { final Options options = new Options(); options.inJustDecodeBounds = true;//ww w. j ava 2 s .c om BitmapFactory.decodeStream(is, null, options); return new int[] { options.outWidth, options.outHeight }; }
From source file:Main.java
public static BitmapFactory.Options decodeImageBounds(final InputStream stream) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;// ww w. j a v a 2 s . c o m BitmapFactory.decodeStream(stream, null, options); if (options.outHeight > 0 && options.outWidth > 0) { return options; } return null; }
From source file:Main.java
public static boolean decodeImageBounds(final InputStream stream, int[] outSize) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;/*from w w w. j a va 2 s. c o m*/ BitmapFactory.decodeStream(stream, null, options); if (options.outHeight > 0 && options.outWidth > 0) { outSize[0] = options.outWidth; outSize[1] = options.outHeight; return true; } return false; }
From source file:Main.java
private static Bitmap decodeBitmapStream(InputStream is) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ALPHA_8; return BitmapFactory.decodeStream(is, null, options); }
From source file:Main.java
public static Pair<Integer, Integer> getDimensionsForStream(InputStream in) { Options options = new Options(); options.inJustDecodeBounds = true;//from ww w. ja v a 2s. c om BitmapFactory.decodeStream(in, null, options); return new Pair<Integer, Integer>(options.outWidth, options.outHeight); }
From source file:Main.java
private static BitmapFactory.Options getImageDimensions(InputStream inputStream) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;// ww w . j a va 2 s. c om BitmapFactory.decodeStream(inputStream, null, options); return options; }
From source file:Main.java
public static void decodeSize(ContentResolver contentResolver, Uri uri, Point out) throws IOException { Options opts = new Options(); opts.inJustDecodeBounds = true;// w w w. j a v a2 s .c o m BitmapFactory.decodeStream(contentResolver.openInputStream(uri), null, opts); out.set(opts.outWidth, opts.outHeight); }
From source file:Main.java
@SuppressWarnings("unused") private static Bitmap getBitmap(InputStream fs) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = 1;/* w ww . j a v a 2s. c o m*/ Bitmap imgBitmap = BitmapFactory.decodeStream(fs, null, opts); if (imgBitmap != null) { int width = imgBitmap.getWidth(); int height = imgBitmap.getHeight(); imgBitmap = Bitmap.createScaledBitmap(imgBitmap, width, height, true); } return imgBitmap; }