File file = new File("E:\a\img.png"); BufferedImage bi = ImageIO.read(file); bi.getWidth(); bi.getHeight();