Android Bitmap Scale getScaledBitmapByHeight(Bitmap bm, int newHeight)

Here you can find the source of getScaledBitmapByHeight(Bitmap bm, int newHeight)

Description

get Scaled Bitmap By Height

Declaration

public static Bitmap getScaledBitmapByHeight(Bitmap bm, int newHeight) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

public class Main {
    public static Bitmap getScaledBitmapByHeight(Bitmap bm, int newHeight) {
        int width = bm.getWidth();
        int height = bm.getHeight();
        int newWidth = (width * newHeight) / height;

        Bitmap scaledBitmap = Bitmap.createScaledBitmap(bm, newWidth,
                newHeight, false);/*  ww  w  .  j  a va2s  . c  o  m*/
        bm.recycle();
        return scaledBitmap;
    }
}

Related

  1. getScalBitmap(Context context, Uri uri, int destW, int destH)
  2. getScalBitmap(String file, int destW, int destH)
  3. getScaledBitmap(Bitmap bitmap, int width, int height)
  4. scaleBitmap(Bitmap bitmap, int dstWidth, int dstHeight)
  5. scaleBitmap(Bitmap bitmap, int targetwidth)
  6. scaleBitmapIfNeededToSize(Bitmap bitmap, long size)
  7. scaleBitmapKeepRatio(Bitmap bitmap, int dstWidth, int dstHeight)