Python中的截屏模塊 pyscreenshot


前言

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM