Skip to content

In Windows 10, how can you capture a rectangular part of the screen selected by the mouse? #7538

Answered by radarhere
nissansz asked this question in Q&A
Discussion options

You must be logged in to vote

You won't be able to use Pillow to get the mouse co-ordinates.

You can use ImageGrab.grab to capture part of the screen once you have the coordinates.

from PIL import ImageGrab
ImageGrab.grab((0, 0, 1, 1))

See https://pillow.readthedocs.io/en/stable/reference/ImageGrab.html#PIL.ImageGrab.grab for more info

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by radarhere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants