Here you can find the source of cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH)
public static BufferedImage cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { public static BufferedImage cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH) { BufferedImage bimage = new BufferedImage(scaleW, scaleH, image.getType());// www.ja v a 2 s . c om Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(image, 0, 0, scaleW - 1, scaleH - 1, cropX, cropY, cropX + cropW - 1, cropY + cropH - 1, null); bGr.dispose(); return bimage; } }