Android Bitmap Resize zoomBitmap(Bitmap bitmap, int width, int height)

Here you can find the source of zoomBitmap(Bitmap bitmap, int width, int height)

Description

zoom Bitmap

Declaration

public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) {
        int w = bitmap.getWidth();
        int h = bitmap.getHeight();
        Matrix matrix = new Matrix();
        float scaleWidth = ((float) width / w);
        float scaleHeight = ((float) height / h);
        matrix.postScale(scaleWidth, scaleHeight);
        Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix,
                true);/*from w w  w .j  a v a  2s .c  o  m*/
        return newbmp;
    }
}

Related

  1. resizeDownBySideLength(Bitmap bitmap, int maxLength, boolean recycle)
  2. resizeDrawable(Context context, int resId, int w, int h)
  3. resizePreviewBitmap(Bitmap bm, int width, int height)
  4. smallImage(Bitmap bitmap, int Width, int Height)
  5. zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)
  6. zoomBitmapAdjustScreen(Activity activity, String imagePath)
  7. zoomImage(Bitmap bgimage, int newWidth, int newHeight)
  8. getResizedBitmap(Bitmap bm, int newHeight, int newWidth)
  9. getResizedBitmap(Bitmap bm, int maxX, int maxY, double maxRatio)