Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {

    private static Bitmap resizeBitmap(Bitmap bmp, float width, float height) {
        float xscale = width / bmp.getWidth();
        float yscale = height / bmp.getHeight();
        Matrix matrix = new Matrix();
        // resize original image
        matrix.postScale(xscale, yscale);
        Bitmap dstbmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
        return dstbmp;
    }
}