Hi,

I need to save the JMapContent to image file like .png or .jpg, but the
image generated is always blank.
I need to know if is possible do it or non.

Here goes a fragment of my code:

File imageFile;

        try {
            
            BufferedImage imageBI = new
BufferedImage(this.jMapPaneArea.getWidth(), this.jMapPaneArea.getHeight(),
BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2d = imageBI.createGraphics();

            this.jMapPaneArea.paint(g2d);
            g2d.dispose();
                        
            this.pathImageFile = "/home/mesquita/image.png";      
            imageFile = new File(pathImageFile); 
            
            ImageIO.write(imageBI, "png", imageFile);
            System.out.println("Image created successfully.");           
        }

Gustavo Mesquita.     

-----
Gustavo Mesquita da Silva.
Brazilian Navy Hydrographic Center
NiterĂ³i, Rio de Janeiro - Brazil
--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Need-to-save-the-JMapPane-content-to-Image-file-tp6495634p6495634.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to