我正在使用ImageGrab截取屏幕截图,并且我想添加填充,以便仅截取屏幕特定区域的截屏,但是ImageGrab无法识别填充。我缺少任何注释或解决方法吗?
from PIL import ImageGrab
import os
import time
#Global Variables
#---------------
x_pad = 57
y_pad = 160
def screenGrab():
box = (x_pad+1, y_pad+1, x_pad+712, y_pad+1064)
im = ImageGrab.grab()
im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) +
'.png', 'PNG')
def main():
screenGrab()
if __name__ == '__main__':
main()