Pyscreenshot is a Python library (version 3.1) designed for taking screenshots across various operating systems. It acts as a pure Python wrapper around existing backend tools. While often considered 'obsolete' in favor of Pillow's native ImageGrab on Linux/macOS, it remains useful for its flexible backend support, Wayland compatibility, and optional subprocess handling. The library's release cadence is irregular, with the latest major update in March 2023.
pip install pyscreenshot PillowVerified import paths — ran on the pinned version, not inferred.
Captures the entire screen and saves it as a PNG file. You can also specify a bounding box for partial screen captures. Ensure Pillow is installed to save and display images.
Consider using `from PIL import ImageGrab` directly if Pillow meets your needs.
Experiment with different backends (e.g., `ImageGrab.grab(backend='grim')` on Sway) or be aware of desktop environment behaviors. Check `xdg-desktop-portal` settings for confirmation dialogs.
Adjust OS display scaling to 100% if encountering this issue, or explore alternative screenshot tools if this is a persistent problem in your environment.
Run your Python script from a command-line terminal instead of IDLE. If hanging persists, try `im = ImageGrab.grab(childprocess=False)` to disable subprocess isolation for the backend.
Use `ImageGrab.grab()` to get an `Image` object and then `im.save()` for more reliable control over saving, format, and region.