Hello,
I am using BufferedImage to read size of image (width and height).
This is happening in loop.
Method which is reading picture:
protected ImageInfo readImageInfo(File file){
ImageInfo retVal = new ImageInfo();
try {
System.out.println(file.getAbsolutePath());
BufferedImage img = ImageIO.read(file);
int width = img.getWidth();
int height = img.getHeight();
if(width > retVal.getWidth()){
height = (retVal.getWidth() * height)/width;
retVal.setHeight(height);
}else{
retVal.setHeight(height);
retVal.setWidth(width);
}
} catch (IOException e) {
e.printStackTrace();
}
return retVal;
}
Number of picture can reach 100 000, and their approximate size is usually less than 1MB but it can be up to 5MB.
Why I am getting this exception and how to solve this?
Any help will be appreciated.
Thanks in advance!
passengerns