Registry / testing / pyscreenshot

pyscreenshot

JSON →
library3.1pypypiunverified

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 Pillow
INSTALL
IMPORT
SIG · PYSCREENSHOT
P
pyscreenshot
testingpythonv3.1
Install
2.4s avg
Import
87ms
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.090s · 38.9MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 2.4s · import 0.084s · 40MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ImageGrab
✓ import pyscreenshot as ImageGrab

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.

import pyscreenshot as ImageGrab import os # Grab the entire screen im = ImageGrab.grab() # Save image to a file file_path = "screenshot.png" im.save(file_path) print(f"Screenshot saved to {file_path}") # Optionally grab a specific region (bbox = (left, top, right, bottom)) # im_region = ImageGrab.grab(bbox=(10, 10, 510, 510)) # im_region.save("screenshot_region.png") # print("Region screenshot saved to screenshot_region.png") # To display the image (requires an image viewer configured for .show()) # im.show()
Debug
Known issues
deprecatedPyscreenshot is often considered obsolete as Pillow's native ImageGrab module now supports Linux and macOS. Use Pillow directly unless you need pyscreenshot's specific backend flexibility or Wayland support.
fix
Consider using `from PIL import ImageGrab` directly if Pillow meets your needs.
affects: All versions
gotchaOn Wayland, certain desktop environments (KDE, GNOME) might display on-screen notifications or flash effects during a screenshot, or `xdg-desktop-portal` might trigger a confirmation dialog. Not all Wayland compositors are equally supported by all backends.
fix
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.
affects: All versions
gotchaIf the operating system's display zoom factor is applied, `ImageGrab.grab()` may not capture the full screen correctly, resulting in black borders or incomplete images.
fix
Adjust OS display scaling to 100% if encountering this issue, or explore alternative screenshot tools if this is a persistent problem in your environment.
affects: All versions
gotchaRunning `pyscreenshot` commands directly in IDEs like IDLE can cause the application to hang or freeze.
fix
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.
affects: All versions
gotchaThe `grab_to_file` function (if used) might ignore the `bbox` parameter, always capturing the entire screen, and may struggle with image formats other than PNG.
fix
Use `ImageGrab.grab()` to get an `Image` object and then `im.save()` for more reliable control over saving, format, and region.
affects: All versions
Upgrade
Version history
3.1latest on PyPI · released Mar 12, 2023
Audit
Dependencies
PillowrequiredRequired for handling the captured image in memory (e.g., saving to file, displaying).
EasyProcessoptionalUsed internally by pyscreenshot for calling external programs.
entrypoint2optionalUsed internally for generating command-line interfaces.
MSSoptionalA fast, pure Python, multiplatform backend.
jeepneyoptionalUsed for D-Bus calls, relevant for some Wayland backends.
Agent activity
7 hits · last 30 days
node
4
Resources
pyscreenshot — pip install pyscreenshot · libregistry