话不多说上源码
//裁剪
public void crop(String src, String dst, int x, int y, int w, int h) throws IOException {
BufferedImage bis = ImageIO.read(new File(src));
//创建的画板
BufferedImage bid = new BufferedImage(w, h, 1);
//画笔
Graphics2D g = bid.createGraphics();
//第一组是将读取的图片写在什么位置 第二组坐标是从什么范围开始读原文件
g.drawImage(bis, 0, 0, w, h, x, y, x + w, y + h, null);
ImageIO.write(bid, "jpg", new FileOutputStream(dst));
g.dispose();
}