Re: Speeding up writing to JPG file
Posted by Cmar on Jul 15, 2016; 7:50am
URL: https://forum.jogamp.org/Speeding-up-writing-to-JPG-file-tp4036909p4036916.html
Hello,
The code that I have now is
drawable.display();
image = bufferUtil.readPixelsToBufferedImage(drawable.getGL(), false);
ImageIO.write(image, "jpg", outputFile);
...where bufferUtil is AWTGLReadBufferUtil.
An alternative code would have been using a GLReadBufferUtil:
drawable.display();
bufferUtil.readPixels(drawable.getGL(), false);
bufferUtil.write(outputFile);
The second approach is slower, because it internally creates a BufferedImage for every layer that I render, whereas the first method reuses the same BufferedImage.
I'm just wondering if there's anything I can do to speed this up (without reducing image size), or an alternative method I might have missed that is better for just writing.