通过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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-11-27
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
猜你喜欢
  • 2021-06-04
  • 2021-07-28
  • 2021-04-23
  • 2021-06-29
  • 2021-12-18
  • 2021-05-27
  • 2022-12-23
相关资源
相似解决方案