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.util.Log;

public class Main {
    public static Bitmap autoResizeByWidth(Bitmap bitmap, int width) {
        float w = bitmap.getWidth();
        float h = bitmap.getHeight();
        int height = (int) (h / w * width);
        return resize(bitmap, width, height);
    }

    public static Bitmap resize(Bitmap bitmap, int width, int height) {
        Log.e("bmhelper", width + "  " + height);
        return Bitmap.createScaledBitmap(bitmap, width, height, true);
    }
}