Skip to main content

A Python Package to ScreenShot Using DXGI API

Project description

DXGISS Python Wrapper

轻量级的 Windows 屏幕捕获封装,基于本地 DXGISS.dll(使用 DXGI)。提供一个简单的 Python 类 DXGI 用于设置捕获区域并获取帧作为 numpy.ndarray

特性

  • 通过 DirectX/DXGI 高效捕获屏幕
  • 返回 numpy 数组:形状为 (height, width, channels),数据类型为 uint8
  • 可选保留 Alpha 通道(BGRA)或仅 BGR

要求

  • Windows(Win32 API + DXGI)
  • Python 3.8+
  • numpy
  • 本地 DLL:DXGISS/DXGISS.dll(必须随包一起提供)

安装

  1. 确保 DXGISS.dll 位于包资源路径:DXGISS/DXGISS.dll
  2. 安装 Python 依赖:
pip install numpy
  1. 以可编辑模式安装项目(可选):
pip install -e .

使用示例

from dxgiss import DXGI
import numpy as np

# 创建对象:默认自动设置为全屏捕获
cap = DXGI(autoRegion=True, needAlphaChannel=False)

# 捕获一帧
img = cap.capture_frame()  # 返回 shape = (height, width, 3) 或 (height, width, 4)

# 示例:显示信息
print(img.shape, img.dtype)  # e.g. (1080, 1920, 3) uint8

# 释放资源
cap.release()

API(简要)

  • DXGI(autoRegion=True, needAlphaChannel=False)
    • autoRegion: 是否自动设置为全屏(bool)
    • needAlphaChannel: 是否保留 Alpha(bol)
  • set_capture_region(x, y, width, height)
    • 设置捕获区域(像素坐标与尺寸)
  • capture_frame() -> numpy.ndarray
    • 捕获并返回一帧;通道数由构造参数决定(3 = BGR, 4 = BGRA)
  • release()
    • 释放底层捕获实例

常见问题

  • 找不到 DLL:确认 DXGISS/DXGISS.dll 路径正确且包含在包资源中。
  • 捕获失败:确认运行环境为 Windows 并且有必要的 DXGI 支持;检查是否有权限或显示驱动问题。

许可证

请根据项目需要添加合适的许可证文件(例如 LICENSE)。

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

dxgiss-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

dxgiss-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file dxgiss-0.1.0.tar.gz.

File metadata

  • Download URL: dxgiss-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dxgiss-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1fe70228f7c126c843d2d910f8931b555377aabbc22d538b3260e4f486bf6ecd
MD5 7646e92cdfaf1389fe8bafe0920027a7
BLAKE2b-256 32fa45129b06b73ad603d6e52e67751eb613722542824b6cfd7026a901efde0b

See more details on using hashes here.

File details

Details for the file dxgiss-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dxgiss-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for dxgiss-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3219502bab485e19c149978fef0c1f0423c124be0655b1614f8a76ef23bf97cb
MD5 3bd68cb8a705dfd84c3730d1c4b527ae
BLAKE2b-256 0ea9d3d290ff5c84aa5b8c94a24f5b3a82a10be56d9c41320719e63dd44991ca

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