Android Bitmap Resize resize(Bitmap bitmap, int newWidth, int newHeight)

Here you can find the source of resize(Bitmap bitmap, int newWidth, int newHeight)

Description

Resize.

Parameter

Parameter Description
bitmap the bitmap
newWidth the new width
newHeight the new height

Return

the bitmap

Declaration

public static Bitmap resize(Bitmap bitmap, int newWidth, int newHeight) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    /**//from w ww  .ja va  2s. c o m
     * Resize.
     * 
     * @param bitmap
     *            the bitmap
     * @param newWidth
     *            the new width
     * @param newHeight
     *            the new height
     * @return the bitmap
     */
    public static Bitmap resize(Bitmap bitmap, int newWidth, int newHeight) {

        Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, newWidth,
                newHeight);

        // make a Drawable from Bitmap to allow to set the BitMap
        // to the ImageView, ImageButton or what ever
        return resizedBitmap;
    }
}

Related

  1. createFitCenterBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight, boolean tryRecycleSource)
  2. createFitXYBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight, boolean tryRecycleSource)
  3. getSampledBitmap(String filePath, int reqWidth, int reqHeight)
  4. manageBitmapRotatio(int photoW, int photoH, Bitmap bitMap, int rotation)
  5. readBitmapAutoSize(String filePath, int outWidth, int outHeight)
  6. resizeAndCropCenter(Bitmap bitmap, int size, boolean recycle)
  7. resizeAndCropCenter(final Bitmap bitmap, final int size)
  8. resizeBitmap(Context context, int resId, int w, int h)
  9. resizeBitmapByScale(Bitmap bitmap, float scale, boolean recycle)