I am creating an application in Java to capture a screenshot at a time interval using the following code:
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot().createScreenCapture(screenRect);
ImageIO.write(capture, "bmp",new File("img/screenshot.png"));
I got the output but the problem is that the size of image is near 3MB. How I can decrease the size of the image at time of capturing it?