aio*_*obe 20
你通常会
BufferedImage(dst下方).Graphics对象src如下)BufferedImageImageIO.在代码中:
Image src = ImageIO.read(new File("duke.jpg"));
int x = 10, y = 20, w = 40, h = 50;
BufferedImage dst = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
dst.getGraphics().drawImage(src, 0, 0, w, h, x, y, x + w, y + h, null);
ImageIO.write(dst, "png", new File("duke_cropped.png"));
Run Code Online (Sandbox Code Playgroud)
鉴于此.jpg ...

...它生成这个.png:
