Skip to main content

"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. Note 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:

  1. Open an issue to discuss significant changes.
  2. Branch from main using feature/<short-desc>.
  3. Keep commits small and focused. Add tests for bug fixes/features.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wgcapture-0.1.1.tar.gz (247.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wgcapture-0.1.1-py3-none-any.whl (250.5 kB view details)

Uploaded Python 3

File details

Details for the file wgcapture-0.1.1.tar.gz.

File metadata

  • Download URL: wgcapture-0.1.1.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

Hashes for wgcapture-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e9cac2a77be9660e0202c548ab9ac6e3b813a1bef6342d336f2115128e2f53cd
MD5 ed3e432b80b5b39d64617b8213a490a3
BLAKE2b-256 8f5704e9a2422136af3163416f72fd36e2ce78a6bacdf777ac0adcab5e98dad7

See more details on using hashes here.

File details

Details for the file wgcapture-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wgcapture-0.1.1-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

Hashes for wgcapture-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b2254fff09312ef094f0e673703ea0d997ece467a5d69c6b6264dce15c84883
MD5 0819b32e970d2f17369045387e17c751
BLAKE2b-256 0cf59c481cd339a6024a9d4a945ac449109f553800be8c5fe598a5fe7729e481

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page