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

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

Description

zoom Image

Declaration

public static Bitmap zoomImage(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 zoomImage(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);//from w  w  w  .j  av  a2  s  .c  o  m
        return bitmap;

    }
}

Related

  1. resizePreviewBitmap(Bitmap bm, int width, int height)
  2. smallImage(Bitmap bitmap, int Width, int Height)
  3. zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)
  4. zoomBitmap(Bitmap bitmap, int width, int height)
  5. zoomBitmapAdjustScreen(Activity activity, String imagePath)
  6. getResizedBitmap(Bitmap bm, int newHeight, int newWidth)
  7. getResizedBitmap(Bitmap bm, int maxX, int maxY, double maxRatio)
  8. getSafeResizingBitmap(String strImagePath, int nMaxResizedWidth, int nMaxResizedHeight, boolean checkOrientation)