VOOZH about

URL: https://www.geeksforgeeks.org/python/python-pil-imagegrab-grab-method/

⇱ Python PIL | ImageGrab.grab() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python PIL | ImageGrab.grab() method

Last Updated : 3 May, 2022

PIL is the Python Imaging Library which provides the python interpreter with image editing 
capabilities. The ImageGrab module can be used to copy the contents of the screen or the clipboard to a PIL image memory.
PIL.ImageGrab.grab() method takes a snapshot of the screen. The pixels inside the bounding box are returned as an “RGB” image on Windows or “RGBA” on macOS. If the bounding box is omitted, the entire screen is copied.
 

Syntax: PIL.ImageGrab.grab(bbox=None)

parameters: 
bbox: What region to copy. Default is the entire screen.

Returns: An image


 

Output: 
 

👁 Image


 

Output: 
 

👁 Image


Different values of bbox can be used for different screen sizes.
 

Comment
Article Tags: