Here you can find the source of compressImage(BufferedImage originalImage, int type, int width, int height)
private static BufferedImage compressImage(BufferedImage originalImage, int type, int width, int height)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.BufferedImage; public class Main { private static BufferedImage compressImage(BufferedImage originalImage, int type, int width, int height) { BufferedImage resizedImage = new BufferedImage(width, height, type); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, width, height, null); g.dispose();/* w w w . ja v a2 s .c o m*/ return resizedImage; } }