How can I generate huge image using java?
In my project, i need draw a complicate image, we use bufferedImage to get Graphics. Below is the code.
BufferedImage ssi = new BufferedImage(width,height,java.awt.image.BufferedImage.TYPE_INT_ARGB);
graphics = ssi.createGraphics();
As the width and height is cacluate accroding to a xml. Sometimes, width and height is very big, such as 9000*9000, which need consume about 243M heap space. It will lead to out of memory issue.
I read some materials related to JAI from java.net. But I still have some questions. Would you please take a look?
1. As the image is huge, If I draw within memory, the oom will happen. So Can i draw the picture using some cahe, swap space?
2. As the items in the image is connected, such as a line connect to image. Is ther any easy way to draw the image?
3. I saw some one mention JDI + ImageIO. I am not very clear about it. Can they solve my issues?
Thanks in advance.