Skip to main content

winhdrshot

Windows HDR / SDR desktop screenshot library. Captures desktop frames via DXGI Desktop Duplication, normalizes them to linear scRGB, then encodes to PQ HDR AVIF.

Features

  • DXGI Desktop Duplication (IDXGIOutput5::DuplicateOutput1) capture, direct D3D11 texture readback
  • Three desktop formats supported:
    • R16G16B16A16_FLOAT (HDR scRGB, 16-bit float linear)
    • R10G10B10A2_UNORM (HDR10 / Auto HDR, 10:10:10:2 packed)
    • B8G8R8A8_UNORM (SDR 8-bit)
  • Unified to linear scRGB float32 (H, W, 3)
  • scRGB → PQ (SMPTE ST 2084) → 10-bit AVIF, with CICP metadata (BT.709 primaries + PQ transfer)

Install

pip install winhdrshot

Usage

from winhdrshot import HDRScreenCapture, encode_scrgb_frame_to_avif, list_monitors

print(list_monitors())

with HDRScreenCapture(monitor_index=0) as cap:
    scrgb = cap.grab_frame()                       # scRGB float32 (H, W, 3), HDR or SDR
    avif_bytes = encode_scrgb_frame_to_avif(scrgb) # HDR AVIF bytes
    open("out.avif", "wb").write(avif_bytes)

Dependencies

  • comtypes — COM interface calls
  • d3dshot — comtypes declarations for DXGI / D3D11 interfaces
  • imagecodecs — AVIF encoding (libavif), supports CICP metadata
  • numpy

Limitations

  • Windows only (DXGI Desktop Duplication API)
  • Requires a D3D11.0+ device
  • R10G10B10A2 (HDR10) format clips HDR highlights to 1.0 — this is the inherent ceiling of 10-bit UNORM, not a bug; for the full HDR dynamic range the desktop must be in R16G16B16A16_FLOAT mode
  • AVIF is lossy (lossless mode unavailable), so some color deviation is expected
  • Color space: desktop duplication yields scRGB (BT.709 primaries + linear + (1,1,1)=80 nits), not BT.2020

License

AGPL-3.0-or-later

Metadata

Release files for winhdrshot 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for winhdrshot 0.1.0
File Size Uploaded
winhdrshot-0.1.0.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for winhdrshot 0.1.0
File Interpreter ABI Platform
winhdrshot-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / winhdrshot-0.1.0.tar.gz

Download URL winhdrshot-0.1.0.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
85500b9d75811d7f72ef9dda3be558ad5d383ebfe24519e48e826c1b8e6b60a9
BLAKE2b-256 checksum
How to use checksums
0fc556bd589938117177f8d73ef3f0b985bf8ef458301389fafe9bfea1ff3a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / winhdrshot-0.1.0-py3-none-any.whl

Download URL winhdrshot-0.1.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d949f8cfb35d8689c01ed49e953c0834dc6c9a9e6b780b604a91acaf01d25124
BLAKE2b-256 checksum
How to use checksums
365e436eeeff9947464167cc7801e7ad80ac31930ab8dc0cd3eea5fe3e4f8079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page