hi, I am trying to generate a huge (15,000 x 20,000 pixels) offline image This image is draw into a JComponent object, which contains different parts of the component, and these parts are put together using swing's pack() method. After that, the JComponent content is copied to a BufferedImage and then splitted into several smaller images.
I am quite sure this is not the most efficient way to do this :-) but since I am working on a 3rd party code, it can take some time to re-write the components draw() methods. The obvious problem is memory. Working in a 32-bit environment, I can't address more than 2GB for the jvm heap, so I am running out of memory easily. Here goes a snippet. What approach do you guys suggest? Thanks in advance. public static BufferedImage createImage(JComponent component, Rectangle region) throws IOException{ boolean opaqueValue = component.isOpaque(); component.setOpaque( true ); logger.debug("image "+region.width+","+region.height); BufferedImage image = new BufferedImage(region.width, region.height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = image.createGraphics(); g2d.setClip( region ); component.paint( g2d ); g2d.dispose(); logger.debug("dispose"); component.setOpaque( opaqueValue ); return image; } [Message sent by forum member 'shikida' (shikida)] http://forums.java.net/jive/thread.jspa?messageID=203869 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".