Pessoal estou tentando cortar uma imagem e salvar, mas as coordenadas não estão corretas.
Ela não esta cortando na área selecionada.
BufferedImage image = ImageIO.read(origemFile);
int x1 = getX1();
int x2 = getX2();
int y1 = getY1();
int y2 = getY2();
int w = image.getWidth();
int h = image.getHeight();
BufferedImage new_img = new BufferedImage(w, h, image.getType());
Graphics2D g = new_img.createGraphics();
g.drawImage(image, x1, y2, w, h,null);
ImageIO.write(new_img, "JPG", new File("/home/pasta/img.jpg"));
