我想用截图,使用python,(仅限Windows)并保存它! 我正在使用pyscreenshot库和PIL
import numpy as np
import matplotlib.pyplot as plt
from PIL import ImageGrab
import pyscreenshot as ImageGrab
img = ImageGrab.grab()
plt.imshow(img, cmap='gray', interpolation='bicubic')
plt.save('img.png')
答案 0 :(得分:0)
试试这段代码:
import pyscreenshot as ImageGrab
# fullscreen
im=ImageGrab.grab()
im.show()
# part of the screen
im=ImageGrab.grab(bbox=(10,10,500,500))
im.show()
# to file
ImageGrab.grab_to_file('im.png')