autopy 在截图时给出一个 ValueError

autopy gives a ValueError when taking a screenshot

我正在尝试使用 autopy 在我的屏幕上拍摄一小部分的图像,但由于某种原因我遇到了错误。作为参考,我在 1920x1080 显示器上 运行。这是代码:

box = ((995, 5), (995 + 212, 5 + 72))
autopy.bitmap.capture_screen(box)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ValueError: The Image's dimensions are either too small or too large

谁能告诉我我做错了什么?

函数

autopy.bitmap.capture_screen

取第一个元组中的左上角,然后在下一个元组中取宽度和高度。因此,要解决您的问题,只需使用

box = ((995, 5), (212, 72))
autopy.bitmap.capture_screen(box)