Here you can find the source of imageResize(BufferedImage image, int width, int height)
Code taken from a stackoverflow answer http://stackoverflow.com/a/14550112/1696114
Parameter | Description |
---|---|
image | a parameter |
public static BufferedImage imageResize(BufferedImage image, int width, int height)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; public class Main { /**//from w ww . jav a 2 s .c o m * Code taken from a stackoverflow answer http://stackoverflow.com/a/14550112/1696114 * @param image * @param width: new width for the image. * @param height: new height for the image. * @return a resized bufferedimage */ public static BufferedImage imageResize(BufferedImage image, int width, int height) { BufferedImage bi = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); Graphics2D g2d = (Graphics2D) bi.createGraphics(); g2d.addRenderingHints( new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)); g2d.drawImage(image, 0, 0, width, height, null); g2d.dispose(); return bi; } }