PIL是Python Imaging Imaging Library,它為python解釋器提供圖像編輯函數
能力。 ImageGrab模塊可用於將屏幕或剪貼板的內容複製到PIL圖像存儲器中。
能力。 ImageGrab模塊可用於將屏幕或剪貼板的內容複製到PIL圖像存儲器中。
PIL.ImageGrab.grabclipboard()
方法拍攝剪貼板圖像的快照(如果有)。
用法: PIL.ImageGrab.grabclipboard()
參數:沒有參數
返回:在Windows上,為圖像,文件名列表,如果剪貼板不包含圖像數據或文件名,則為None。
注意:該模塊僅適用於Windows和Mac OS。
# Importing Image and ImageGrab module from PIL package
from PIL import Image, ImageGrab
# using the grabclipboard method
im = ImageGrab.grabclipboard()
im.show()
輸出:
更改剪貼板上的圖像後
# Importing Image and ImageGrab module from PIL package
from PIL import Image, ImageGrab
# using the grabclipboard method
im = ImageGrab.grabclipboard()
im.show()
輸出:
相關用法
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python next()用法及代碼示例
- Python sys.getrecursionlimit()用法及代碼示例
- Python PIL eval()用法及代碼示例
- Python sympy.rf()用法及代碼示例
- Python os.waitid()用法及代碼示例
- Python os.WIFEXITED()用法及代碼示例
- Python os.scandir()用法及代碼示例
- Python PIL getpalette()用法及代碼示例
- Python sympy.ff()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python sympy.nT()用法及代碼示例
- Python os.sync()用法及代碼示例
注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python PIL | ImageGrab.grabclipboard() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。