Android Bitmap Resize zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)

Here you can find the source of zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)

Description

zoom Bitmap

Declaration

public static Bitmap zoomBitmap(Bitmap bgimage, int newWidth,
            int newHeight) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap zoomBitmap(Bitmap bgimage, int newWidth,
            int newHeight) {
        int width = bgimage.getWidth();
        int height = bgimage.getHeight();

        Matrix matrix = new Matrix();
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        matrix.postScale(scaleWidth, scaleHeight);
        Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, width, height,
                matrix, true);//w  w  w. j  av a  2s.  co m
        return bitmap;
    }
}

Related

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