wgc - Windows Graphics Capture Wrapper
A simple and ergonomic Rust wrapper for Windows.Graphics.Capture API, enabling screen/window capture on Windows 10/11.
Realtime & AI-optimized capture for ML and computer vision workflows.
Features
- Realtime & AI-optimized: Capture any window or monitor at any resolution and resize in real-time using letterbox scaling. Ideal for ML pipelines, streaming, and computer vision applications.
- Ergonomic iterator-based API for capturing frames via the
Wgcstruct - Interactive picker dialog for selecting windows or monitors to capture
- Configurable pixel formats (currently
RGBA8andBGRA8, with more formats planned) viaWgcSettings - Automatic buffer recreation when capture resolution changes
- Frame size normalization with letterboxing for consistent output dimensions
- Optional
tracingfeature for debug logging - Zero-copy frame access with efficient DirectX/Direct2D integration
Requirements
- Windows 10 October 2018 Update (version 1809) or later
- Windows 11 (recommended)
- Rust 2024 edition
Usage
Here's a basic example of how to capture frames:
use *;
Examples
Check out the examples directory for more detailed usage examples:
- save_image: Captures a screen item and saves it as an image file to disk.
- show_image: Captures a screen item and displays it in a window.
- tutorial: Provides a comprehensive tutorial on wgc for those who wish to leverage most of its features.
Development Status
This crate is currently under active development. Features may be added, removed, or changed in future releases. Please check back regularly for updates.
API stability is not guaranteed until version 1.0.0 is released.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.