Example usage for android.graphics BitmapFactory decodeFile

List of usage examples for android.graphics BitmapFactory decodeFile

Introduction

In this page you can find the example usage for android.graphics BitmapFactory decodeFile.

Prototype

public static Bitmap decodeFile(String pathName, Options opts) 

Source Link

Document

Decode a file path into a bitmap.

Usage

From source file:Main.java

public static Bitmap decodeFile(File file, BitmapFactory.Options options) {
    return BitmapFactory.decodeFile(file.getAbsolutePath(), options);
}

From source file:Main.java

public static int getMiniSize(String imagePath) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from  www . j av a2s.c o  m
    BitmapFactory.decodeFile(imagePath, options);
    return Math.min(options.outHeight, options.outWidth);
}

From source file:Main.java

public static String getImageType(String path) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;/*from  www.  j  av a  2 s  .  c  o m*/
    BitmapFactory.decodeFile(path, options);
    return options.outMimeType;
}

From source file:Main.java

public static int getLocalImgHeigh(String pathName) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;/*from  w  ww .ja va 2s.  c om*/
    BitmapFactory.decodeFile(pathName, options);
    return options.outHeight;
}

From source file:Main.java

public static boolean isCorrectPic(String path) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;// www . ja v  a2 s . c  o m
    BitmapFactory.decodeFile(path, options);
    if (options.outWidth < 0 || options.outHeight < 0) {
        return false;
    }
    return true;
}

From source file:Main.java

public static boolean isBrokenImage(final String path) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from   w w  w  .j a v  a 2 s  .c o  m
    BitmapFactory.decodeFile(path, options);
    int imageHeight = options.outHeight;
    int imageWidth = options.outWidth;

    return imageHeight <= 0 || imageWidth <= 0;
}

From source file:Main.java

public static int[] getBitmapWidthAndHeight(String imagePath) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//  ww  w. ja  v  a 2  s .  co m
    BitmapFactory.decodeFile(imagePath, options);
    return new int[] { options.outWidth, options.outHeight };
}

From source file:Main.java

public static long getImageSizeBeforeLoad(String filepath) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//www .j av a 2  s . c  om
    BitmapFactory.decodeFile(filepath, options);
    int imageHeight = options.outHeight;
    int imageWidth = options.outWidth;
    return imageHeight * imageWidth;
}

From source file:Main.java

public static BitmapFactory.Options getBitmapOptions(String fileName) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from   w  w w . j a v  a 2s . c  o  m
    BitmapFactory.decodeFile(fileName, options);
    return options;
}

From source file:Main.java

public static BitmapFactory.Options getBitmapOptions(String path) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from w  w  w  .jav  a  2s .  co m
    BitmapFactory.decodeFile(path, options);
    options.inJustDecodeBounds = false;
    return options;
}