Android Bitmap Scale scaleBitmap(Bitmap bitmap, float scale)

Here you can find the source of scaleBitmap(Bitmap bitmap, float scale)

Description

scale Bitmap

Declaration

public static Bitmap scaleBitmap(Bitmap bitmap, float scale) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.Matrix;

public class Main {

    public static Bitmap scaleBitmap(Bitmap bitmap, float scale) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        Matrix matrix = new Matrix();
        matrix.postScale(scale, scale);/*  ww w  . j av a2s . c om*/
        Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height,
                matrix, true);
        return newBitmap;
    }
}

Related

  1. scaleBitmap(Bitmap bitmap, int width, int height)
  2. scaleBitmap(String path, int newWidth, int newHeight)
  3. scaleClipBitmapByCircle(Bitmap src, int nRadius, float fStrokeWidth)
  4. getScaledImageFromUri(Activity activity, Uri uri, int size)
  5. imageScale(Bitmap bitmap, int dst_w, int dst_h)
  6. scaleBitmapDown(Bitmap bitmap)
  7. scaleToFit(Bitmap bm, float width_Ratio, float height_Ratio)
  8. stretchImage(Bitmap image, float xscale, float yscale)
  9. stretchImage(Bitmap image, int xsize, int ysize)