DEV Community

Mohammed Riyas
Mohammed Riyas

Posted on

Take ScreenShot using Java

  Robot robot=new Robot();
Dimension dimension= Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle=new Rectangle(dimension);
BufferedImage img= robot.createScreenCapture(rectangle);
File f=new File("D://RobotScreenshot1.png");
ImageIO.write(img,"png", f);
Enter fullscreen mode Exit fullscreen mode

I Storing the image in "D://RobotScreenshot1.png" this location.

Top comments (0)