AslanT
AslanT

Reputation: 13

autopy gives a ValueError when taking a screenshot

I'm trying to take an image of a small section on my screen using autopy and for some reason I'm getting an error. For reference, I am running on a 1920x1080 display. Here's the code:

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

Can anyone tell me what I'm doing wrong?

Upvotes: 0

Views: 297

Answers (1)

Sanil Khurana
Sanil Khurana

Reputation: 1169

The function

autopy.bitmap.capture_screen

takes the top left point in the first tuple and then in the next tuple takes the width and the height. So, to fix your problem, simply use

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

Upvotes: 1

Related Questions