public static void main(String[] agrs) {
try {
BufferedImage img = ImageIO.read(new File("D:\\Program Files\\myftp\\3.jpg"));
int w = img.getWidth();
int h = img.getHeight();
BufferedImage subImg = img.getSubimage(0, 0, w/2, h/2);
ImageIO.write(subImg, "jpg", new File("D:\\Program Files\\myftp\\new.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
}