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 int couleurPrincipale(Bitmap image) {
    Bitmap onePixelBitmap = Bitmap.createScaledBitmap(image, 1, 1, true);
    return onePixelBitmap.getPixel(0, 0);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static Bitmap scaleBitmap(Bitmap source, int newWidth, int newHeight) {
    return Bitmap.createScaledBitmap(source, newWidth, newHeight, true);
}

From source file:Main.java

public static Bitmap scale(Bitmap bitmap, int width, int height, boolean recycle) throws OutOfMemoryError {
    Bitmap output = Bitmap.createScaledBitmap(bitmap, width, height, true);
    if (recycle && bitmap != output) {
        bitmap.recycle();//w  w  w. j a  v a 2 s.co  m
    }
    return output;
}

From source file:Main.java

public static Bitmap resizeSquare(Bitmap src, int max) {
    if (src == null) {
        return null;
    }/*from  w  w w. j a v a 2 s  .  c om*/

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

From source file:Main.java

public static Bitmap resizeBitmapFollowReqSize(Bitmap bitmap, int reqW, int reqH) {
    return Bitmap.createScaledBitmap(bitmap, reqW, reqH, true);
}

From source file:Main.java

public static Bitmap getResizedBitmap(Bitmap image, int bitmapWidth, int bitmapHeight) {
    return Bitmap.createScaledBitmap(image, bitmapWidth, bitmapHeight, true);
}

From source file:Main.java

public static Bitmap effectChangeResolution(Bitmap src, int dstWidth, int dstHeight) {
    return Bitmap.createScaledBitmap(src, dstWidth, dstHeight, false);
}

From source file:Main.java

public static Bitmap getSizedBitmap(Bitmap bitmap, int dstWidth, int dstHeight) {
    if (null != bitmap) {
        Bitmap result = Bitmap.createScaledBitmap(bitmap, dstWidth, dstHeight, false);
        return result;
    }//www  .j a  va 2s .  c o  m

    return null;
}