Python - screenshot with PIL

Platform
Windows 7 x86

Prepare
Download python package management tool, and install PIL with pip.

wget.exe https://bootstrap.pypa.io/get-pip.py
C:\Python27\python.exe get-pip.py

Install VCForPython27, and the package will be used during PIL cimpile. Download PIL package, compile PIL and Install it on localhost.

C:\Python27\Scripts\pip.exe install PIL --allow-external PIL --allow-unverified PIL

Screenshot desktop.

PS C:\Users\nfs> C:\Python27\python.exe
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import ImageGrab
>>> im = ImageGrab.grab()
>>> im.save("C:/Users/nfs/Desktop/screenshot.png")
>>> im.close()

screenshot with PIL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值