Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

read buffered image

32 views
Skip to first unread message

Ryan Jones

unread,
Apr 14, 2014, 1:43:12 AM4/14/14
to metsci-...@googlegroups.com
I am attempting to save a jpg image of a plot. The following code is how I thought it should work after doing a bit of research. I have also tried every combination to try and use the correct GL

AWTGLReadBufferUtil readutil = new AWTGLReadBufferUtil (GLProfile.get(GLProfile.GL2GL3),false);
           BufferedImage tScreenshot = readutil.readPixelsToBufferedImage(canvas.getGLDrawable().getGL(),true);
            File tScreenCaptureImageFile = new File("test.jpg"); 
            try { 
                ImageIO.write(tScreenshot, "jpg", tScreenCaptureImageFile);
            } catch (IOException ex) {
                Logger.getLogger(SPDisplay.class.getName()).log(Level.SEVERE, null, ex);
            }

All I get is a black image. Any suggestions?

Ryan Jones

unread,
Apr 14, 2014, 1:53:17 AM4/14/14
to metsci-...@googlegroups.com
Nevermind,

I found your example screenshotutil. 

Geoffrey Ulman

unread,
Apr 14, 2014, 10:06:45 AM4/14/14
to metsci-...@googlegroups.com

Great! Glad the example was helpful.

The next minor release (2.1.2), which should happen sometime this week, includes cleanup and improvements to the screenshot functionality. So the code will be different in that version. The ScreenshotExample class will be updated to demonstrate these changes.
Reply all
Reply to author
Forward
0 new messages