Zaya.Screenshot.Impl.Windows
2.0.0
dotnet add package Zaya.Screenshot.Impl.Windows --version 2.0.0
NuGet\Install-Package Zaya.Screenshot.Impl.Windows -Version 2.0.0
<PackageReference Include="Zaya.Screenshot.Impl.Windows" Version="2.0.0" />
<PackageVersion Include="Zaya.Screenshot.Impl.Windows" Version="2.0.0" />
<PackageReference Include="Zaya.Screenshot.Impl.Windows" />
paket add Zaya.Screenshot.Impl.Windows --version 2.0.0
#r "nuget: Zaya.Screenshot.Impl.Windows, 2.0.0"
#:package Zaya.Screenshot.Impl.Windows@2.0.0
#addin nuget:?package=Zaya.Screenshot.Impl.Windows&version=2.0.0
#tool nuget:?package=Zaya.Screenshot.Impl.Windows&version=2.0.0
Zaya.Screenshot
High-performance screen capture for Windows .NET 8.0+ — Windows Graphics Capture + Direct3D 11, with IRawImage / ReadOnlySpan<byte> pixel access and configurable output formats.
Packages
| Package | Version | Role |
|---|---|---|
| Zaya.Screenshot | 2.0.0 | Abstractions: ICaptureService, ICaptureSession, region types, PixelFormatExtensions |
| Zaya.Screenshot.Impl.Windows | 2.0.0.0 | Windows Graphics Capture + D3D11 (CaptureService, CapturedFrame) |
Requires Zaya.Primitives 2.0.0.
Update channel (GitHub Releases): plugin-Zaya.Screenshot-v2.0-latest
See versioning.
Docs: API & articles
Features
- Capture full desktops, individual windows, or rectangular sub-regions (
FullScreenDesktopRegion,FullScreenWindowRegion,RectDesktopRegion,RectWindowRegion) - Pixel formats: BGRA32, RGB24, BGR24, Gray8
- High-performance
ReadOnlySpan<byte>access viaIRawImage - Engine metadata (
EngineId, localized name/description,Settings) for plugin hosts - Windows engine failures surface as
LocalizedExceptionfor host UI - UI/error strings for the Windows engine:
en,ru,zh-Hans,uk,de,pt,ja,ko,fr,tr,pl - Optional helpers mapping
PixelFormatto SkiaSharp / ImageSharp type names
There is no separate InitializeAsync / pause-resume API: create a session and call CaptureAsync.
Platform
- Windows 10 version 19041 (20H1) or later
- Direct3D 11 compatible GPU with BGRA support
Installation
<PackageReference Include="Zaya.Screenshot" Version="2.0.0" />
<PackageReference Include="Zaya.Screenshot.Impl.Windows" Version="2.0.0.0" />
Plugin zip for ScreenTranslator hosts: Zaya.Screenshot.Impl.Windows.zip from the floating tag above.
Quick Start
using System.Globalization;
using Zaya.Screenshot.Impl.Windows;
using Zaya.Screenshot.Models;
using var service = new CaptureService();
Console.WriteLine(service.DisplayName.GetValue(CultureInfo.CurrentUICulture));
Console.WriteLine(service.IsAvailable);
// Capture entire primary monitor
var region = new FullScreenDesktopRegion();
using var session = await service.CreateSessionAsync(region);
using var frame = await session.CaptureAsync();
if (frame is null)
return;
var pixelData = frame.GetPixelData();
Console.WriteLine($"Captured {frame.Width}x{frame.Height}, format: {frame.Format.Name}");
byte[] copy = frame.ToByteArray();
Capture a Window
var region = new FullScreenWindowRegion { WindowHandle = hwnd };
using var session = await service.CreateSessionAsync(region);
Capture a Rectangular Sub-Region
var region = new RectDesktopRegion
{
DisplayIndex = 0,
// Coordinates relative to the top-left of that display (not the virtual desktop)
Rectangle = new Rectangle(100, 100, 400, 300)
};
Select Pixel Format
var region = new FullScreenDesktopRegion
{
PixelFormat = PixelFormat.Gray8 // 1 byte per pixel, useful for OCR
};
Architecture
Resolve ICaptureService (new / DI / plugin host)
→ Read DisplayName / Description / Settings / IsAvailable
→ CreateSessionAsync(region[, settings])
→ CaptureAsync() → IRawImage
→ Dispose session / service
- Zaya.Screenshot — interfaces and region models
- Zaya.Screenshot.Impl.Windows — Windows Graphics Capture + Direct3D 11
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows10.0.19041 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
net8.0-windows10.0.19041
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Windows.CsWinRT (>= 2.2.0)
- Zaya.Logging (>= 1.0.0)
- Zaya.Screenshot (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.