Taking Screenshots using pyscreenshot in Python

Last Updated : 9 Jan, 2026

Python provides multiple libraries to capture screenshots. One simple option is the pyscreenshot module, which is a pure Python wrapper over existing backends. It is suitable for basic screenshot tasks but not optimized for performance or real-time capture.

Installation

Install the module using pip:

pip install pyscreenshot

Capturing Full Screen

You can capture the entire screen using the grab() function. To display the screenshot, use the show() function.

Python
import pyscreenshot
# Capture the full screen
image = pyscreenshot.grab()

# Display the screenshot
image.show()
# Save the screenshot to a file
image.save("GeeksforGeeks.png")

Output

Full Screenshot

Capturing part of the screen

Here is the simple Python program to capture the part of the screen. Here we need to provide the pixel positions in the grab() function. We need to pass the coordinates in the form of a tuple. 

Syntax:

image = pyscreenshot.grab(bbox=(x1, y1, x2, y2))

  • (x1, y1): Top-left corner
  • (x2, y2): Bottom-right corner
Python
import pyscreenshot
image = pyscreenshot.grab(bbox=(10, 10, 500, 500))
image.show()
image.save("GeeksforGeeks.png")
Comment