I am using Java (Eclipse) to build a application that works with photos.
So I used this link Java get available memory to know how much free memory I still have. The issue is that I have this code:
Main.printMemory("before image");
url = new File(information.getPath()).toURI().toURL();
image = ImageIO.read(url);
Main.printMemory("after image");
And the result is:
Message: before image
Free memory (bytes): 82554768
Maximum memory (bytes): 129957888
Total memory (bytes): 85000192
and
Message: after image
Free memory (bytes): 42600680
Maximum memory (bytes): 129957888
Total memory (bytes): 85000192
So loading that image takes 82554768 - 42600680 = 39954088 bytes = 38 MB
The photo size is 3.3 MB
Is it normal to take so much memory??? Why does it consume so much memory? Is there any way I could reduce this, hopefully maintaining the photo quality?