Java tutorial
//package com.java2s; import java.awt.*; public class Main { /** * Resizes the given image using Image.SCALE_SMOOTH. * * @param image the image to be resized * @param size the size to resize the width/height by (see setWidth) * @param setWidth whether the size applies to the height or to the width * @return the resized image */ public static Image resizeImageBy(Image image, int size, boolean setWidth) { if (setWidth) { return image.getScaledInstance(size, -1, Image.SCALE_SMOOTH); } else { return image.getScaledInstance(-1, size, Image.SCALE_SMOOTH); } } }