"Simple window specific sreengrab using Windows Graphics Capture"
Project description
wgcapture
Consistent, window-based screen captures on Windows using WinRT + Windows Graphics Capture (WGC).
A small library that makes it easy to capture screenshots of Windows (application windows) rather than whole monitors. In particular this helps produce consistent captures across multiple displays, scaling/DPI settings, and systems where monitor-based grabs are unreliable. This also works in borderless and full screen modes.
Note: This package targets Microsoft Windows and uses Windows-specific APIs (WinRT + Windows Graphics Capture). It will not work on macOS or Linux.
You can view the project files related to the DLL on the github repo
https://github.com/spartan3661/WGCapture
Features
- Capture a specific application window by title
- Produce a numpy.ndarray dtype: np.uint8(0-255) shape: (height, width, 4) channels: RGBA
- Lightweight, dependency-minimal wrapper around WinRT/WGC functionality
- Works reliably across high-DPI displays and mixed-scaling setups
Installation
Install from PyPI:
pip install wgcapture
Or install from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple wgcapture==0.1.0
Requirements
- Windows 10 / 11 (WinRT and Windows Graphics Capture support)
- Python 3.8+
pip install Pillow
Quickstart
The code below is a ready-to-edit example.
from wgcapture import capture_screen
from PIL import Image
# Capture by window title (first match)
img = capture_screen(screen="Untitled - Notepad")
Image.fromarray(img, mode="RGBA").show()
API
capture_screen(screen: str = None)
Contributing
Contributions welcome! Please follow these guidelines:
- Open an issue to discuss significant changes.
- Branch from
mainusingfeature/<short-desc>. - Keep commits small and focused. Add tests for bug fixes/features.
- Open a PR and request review.
Add a CONTRIBUTING.md with more specifics if you want.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Acknowledgements
Built on top of WinRT and Windows Graphics Capture APIs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wgcapture-0.1.2.tar.gz.
File metadata
- Download URL: wgcapture-0.1.2.tar.gz
- Upload date:
- Size: 247.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad634fdc7be082c7aef0e37a155e16f423156d2c800c5e995bc4c297dbed2ce7
|
|
| MD5 |
e26fcae251aef96ce61bc9c319104a43
|
|
| BLAKE2b-256 |
e20eb9b4a29860a68beac54c3edbe0661e821cf4c60fc71896975eae63360a3e
|
File details
Details for the file wgcapture-0.1.2-py3-none-any.whl.
File metadata
- Download URL: wgcapture-0.1.2-py3-none-any.whl
- Upload date:
- Size: 250.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbbdc27189e05abac6ca0f0b11b7af1c89b05d92c52302ea0c98eeb8e658d1da
|
|
| MD5 |
43cb0d718c58ca4b3328d66565f28fc0
|
|
| BLAKE2b-256 |
37d8030671755d34a10483435658ab1e4f23e44946e2af0d4fa15b59eabea387
|