Example usage for android.graphics Bitmap createScaledBitmap

List of usage examples for android.graphics Bitmap createScaledBitmap

Introduction

In this page you can find the example usage for android.graphics Bitmap createScaledBitmap.

Prototype

public static Bitmap createScaledBitmap(@NonNull Bitmap src, int dstWidth, int dstHeight, boolean filter) 

Source Link

Document

Creates a new bitmap, scaled from an existing bitmap, when possible.

Usage

From source file:Main.java

public static Bitmap changeBitmapSize(Bitmap source, int width, int height) {
    Bitmap sink = Bitmap.createScaledBitmap(source, width, height, true);
    return sink;/*w  w  w.  j  a va 2  s  . com*/
}

From source file:Main.java

public static Bitmap decodeBitmap(Bitmap bmp, int displayWidth, int displayHeight) {
    return Bitmap.createScaledBitmap(bmp, displayWidth, displayHeight, true);
}

From source file:Main.java

public static Bitmap createScaleBitmap(Bitmap src, int dstWidth, int dstHeight) {
    Bitmap dst = Bitmap.createScaledBitmap(src, dstWidth, dstHeight, false);
    if (src != dst) {
        src.recycle();/*from   w  w  w  . j a  v  a2s.c  o m*/
    }
    return dst;
}

From source file:Main.java

public static Bitmap scale(Bitmap bitmap, int width, int height) {
    return Bitmap.createScaledBitmap(bitmap, width, height, true);
}

From source file:Main.java

public static Bitmap getRescaledBitmap(final Bitmap bit, final int x, final int y, final boolean flag) {

    return Bitmap.createScaledBitmap(bit, x, y, true);

}

From source file:Main.java

public static Bitmap reduceBitmap(Bitmap bitmap, int w, int y) {
    if (bitmap != null)
        return bitmap = Bitmap.createScaledBitmap(bitmap, w, y, true);
    else// ww  w .  j a v  a 2s .  c  om
        return null;
}

From source file:Main.java

public static Bitmap resizeSquare(Bitmap src, int max) {
    if (src == null)
        return null;

    return Bitmap.createScaledBitmap(src, max, max, true);
}

From source file:Main.java

public static Bitmap scaleToFitWidth(Bitmap b, int width) {
    float factor = width / (float) b.getWidth();
    return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), true);
}

From source file:Main.java

static public Bitmap scaleToFitWidth(Bitmap b, int width) {
    float factor = width / (float) b.getWidth();
    return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), false);
}

From source file:Main.java

static public Bitmap scaleToFitWidth(Bitmap b, int width) {
    float factor = width / (float) b.getWidth();
    return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), true);
}