Example usage for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT

List of usage examples for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT

Introduction

In this page you can find the example usage for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT.

Prototype

int OPTIONS_RECYCLE_INPUT

To view the source code for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT.

Click Source Link

Document

Constant used to indicate we should recycle the input in #extractThumbnail(Bitmap,int,int,int) unless the output is the input.

Usage

From source file:Main.java

public static Bitmap getBitmapThumbnail(Bitmap bmp, int width, int height) {
    Bitmap bitmap = null;/*from   w  w w . j a va  2  s. c o m*/
    if (bmp != null) {
        bitmap = ThumbnailUtils.extractThumbnail(bmp, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    }
    return bitmap;
}

From source file:Main.java

public static Bitmap createVideoThumbnail(String vidioPath, int width, int height, int kind) {
    Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(vidioPath, kind);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:Main.java

public static Bitmap getVideoThumbnail(String videoPath, int width, int height, int kind) {
    Bitmap bitmap;//from   w  w w.ja va 2 s .co  m
    bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:Main.java

public static Bitmap getVideoThumbnail(String videoPath, int width, int height, int kind) {
    Bitmap bitmap = null;//from ww  w.  ja v  a 2s  .  c  om
    bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:Main.java

public static Bitmap getVideoThumbnail(String filePath, int width, int height, int kind) {
    Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath, kind);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:Main.java

public static Bitmap getApkResizedIcon(Context context, String apkPath, int width, int height) {
    Bitmap thumb = getApkIcon(context, apkPath);
    if (thumb != null) {
        return ThumbnailUtils.extractThumbnail(thumb, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    }// w w  w.j av  a2  s .  c o  m
    return thumb;
}

From source file:Main.java

public static Bitmap getVideoImage(String urlPath) {
    Bitmap bitmap = null;/*  w  w  w . j  a  va2 s . c  o  m*/
    bitmap = ThumbnailUtils.createVideoThumbnail(urlPath, MediaStore.Images.Thumbnails.MICRO_KIND);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, 100, 80, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:Main.java

@Deprecated
public static Bitmap getBitmapThumbnail(Bitmap source, int width, int height) {
    return ThumbnailUtils.extractThumbnail(source, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
}

From source file:Main.java

public static Bitmap getPictureImage(String urlPath) {
    Bitmap bitmap = null;//from w  ww. j av a2  s  .  c o  m
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    bitmap = BitmapFactory.decodeFile(urlPath, options);
    options.inJustDecodeBounds = false;
    int h = options.outHeight;
    int w = options.outWidth;
    int beWidth = w / 100;
    int beHeight = h / 80;
    int be = 1;
    if (beWidth < beHeight) {
        be = beWidth;
    } else {
        be = beHeight;
    }
    if (be <= 0) {
        be = 1;
    }
    options.inSampleSize = be;
    bitmap = BitmapFactory.decodeFile(urlPath, options);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, 100, 80, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}

From source file:com.ape.transfer.util.FileIconLoader.java

public static Bitmap getMyImageThumbnail(String filePath, int width, int height) {
    File file = new File(filePath);
    if (!file.exists())
        return null;

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;//from  w w w  .j  av a2 s  . c o m

    // Decode the width and height of the bitmap, but don't load the bitmap
    // to RAM
    BitmapFactory.decodeFile(file.getPath(), options);

    int max = Math.max(options.outHeight, options.outWidth);

    // Compute the sampleSize of the options
    int size = (int) (max / (float) Math.max(width, height));
    if (size <= 0) {
        size = 1;
    }
    options.inSampleSize = size;

    // Decode the width and height of the bitmap and load the bitmap to RAM
    options.inJustDecodeBounds = false;

    Bitmap iconBitmap = BitmapFactory.decodeFile(file.getPath(), options);

    iconBitmap = ThumbnailUtils.extractThumbnail(iconBitmap, width, height,
            ThumbnailUtils.OPTIONS_RECYCLE_INPUT);

    return iconBitmap;
}