I've an application where I'm writing around 25 png image files to disk every second.
BufferedImage img = getBufferedImage();
// code below is very slow ~150ms.
File file = new File(count++ + ".png");
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file));
ImageIO.write(img, "png", os);
It usually takes 150ms per call, and achieving 25fps hence becomes impossible. Can I buffer IO so that I don't drop any frames?
PNG encoding takes a while and you can't improve it with any buffering ... if you want a speed up, use BMP (which will eat up your HDD) or if pixel-quality is not needed, try JPG (which should get encoded faster than PNG).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With