Is there a way to get the dimensions of an image without reading the entire file?
URL url=new URL(<BIG_IMAGE_URL>);
BufferedImage img=ImageIO.read(url);
System.out.println(img.getWidth()+" "+img.getHeight());
img=null;
Is there a way to get the dimensions of an image without reading the entire file?
URL url=new URL(<BIG_IMAGE_URL>);
BufferedImage img=ImageIO.read(url);
System.out.println(img.getWidth()+" "+img.getHeight());
img=null;
The solution with ImageInputStream and ImageReader is still not so efficient though because they create tmp files. It becomes much slower when image is larger or concurrency is higher, i recommend to use metadata-extractor instead.