前言
pyscreenshot 是一個 Python 的模塊,用來對屏幕進行截屏並拷貝到 PIL or Pillow 圖像對象中。這是一個純 Python 庫,支持跨平台。
示例代碼:
import pyscreenshot as ImageGrab
fullscreen
im=ImageGrab.grab()
im.show()
part of the screen
im=ImageGrab.grab(bbox=(10,10,510,510)) # X1,Y1,X2,Y2
im.show()
1
2
3
4
5
6
7
8
9
Ubuntu 下安裝:
sudo apt-get install python-pip
sudo pip install pyscreenshot
sudo apt-get install python-imaging
optional back-ends
sudo apt-get install scrot
sudo apt-get install imagemagick
sudo apt-get install python-gtk2
sudo apt-get install python-qt4
optional for examples
sudo pip install entrypoint2
卸載:
as root
pip uninstall pyscreenshot
類似的項目還有:
gtkShots
autopy