resize Image - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Resize

Description

resize Image

Demo Code


//package com.java2s;

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage resizeImage(BufferedImage originalImage,
            int IMG_WIDTH, int IMG_HEIGHT, int type) {
        BufferedImage resizedImage = new BufferedImage(IMG_WIDTH,
                IMG_HEIGHT, type);//  ww  w .  ja v a2 s .  c o  m
        Graphics2D g = resizedImage.createGraphics();
        g.drawImage(originalImage, 0, 0, IMG_WIDTH, IMG_HEIGHT, null);
        g.dispose();
        return resizedImage;
    }
}

Related Tutorials