Java examples for 2D Graphics:BufferedImage Scale
scale BufferedImage Image
//package com.java2s; import java.awt.image.BufferedImage; public class Main { public static BufferedImage scaleImage(BufferedImage originalImage, int multiplier) { int imageWidth = originalImage.getWidth(); int imageHeight = originalImage.getHeight(); BufferedImage scaledImage = new BufferedImage(imageWidth * multiplier, imageHeight * multiplier, BufferedImage.TYPE_INT_ARGB); for (int x = 0; x < scaledImage.getWidth(); x++) { for (int y = 0; y < scaledImage.getHeight(); y++) { int scaledX = new Double(x / (double) scaledImage.getWidth() * originalImage.getWidth()).intValue(); int scaledY = new Double(y / (double) scaledImage.getHeight() * originalImage.getHeight()).intValue(); scaledImage.setRGB(x, y, originalImage.getRGB(scaledX, scaledY)); }// ww w .ja va 2s .c om } return scaledImage; } }