最简单的截屏程序

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值