Is it possible to compress an image before saving it? I'm using the Robot class to capture images, and it returns a BufferedImage. How can I compress this image and then save it?
.png files are (losslessly) compressed images.
You can use ImageIO.write() to save a .png image:
ImageIO.write(myBufferedImage, "png", outputfile);
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