通过java实现的
可以设置截取的高宽,直接保存到磁盘上。
原创不易,转载请注明出处:最简单的截屏程序
package com.zuidaima.capture;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class RobotExp {
public static void main(String[] args) {
try {
Robot robot = new Robot();
// Capture the screen shot of the area of the screen defined by the
// rectangle
BufferedImage bi = robot
.createScreenCapture(new Rectangle(1024, 768));
ImageIO.write(bi, "jpg", new File("C:/imageTest.jpg"));
} catch (AWTException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
代码下载地址: http://www.zuidaima.com/share/1550463399152640.htm