I want to load large images (18000 x 18000) to my application. If i use BufferedImage
with type int_rgb
, I need around 1235mb of heap memory to load. This is a very high amount of memory, and end users will likely have less ram (1GB or less).
On my development PC, when I load the image from MyEclipse IDE, it throws an out of memory Exception
. When i pack my code to an executable jar and run it on my PC external of Eclipse, it still throws an exception.
How do I load such a large image into my application using buffered image without using 1235mb of memory? Is there a trick, like splitting the image into smaller portions like image segmentation?
I found this thread on SO, but it not useful for me; I want to load the image into BufferedImage
and then draw it on a Panel
using the Graphics
class.