python-mss

BoboTiGMIT活跃维护

纯 Python 实现的超快跨平台截图库,基于 ctypes 直接调用系统接口,能一次抓取多个显示器画面,适合做屏幕采集和自动化工具。

An ultra fast cross-platform multiple screenshots module in pure Python using ctypes.

v10.2.0发布于 2026-04-23 10:48 UTC1,288star117fork同步于 2026-11-10 05:55 UTC

怎么上手

从 README 代码块原样提取,可能是其中一种安装方式
conda install -c conda-forge python-mss
硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v10.2.0
  1. v10.2.010.2.0最新正式版2026-04-23 · 2026-04-23 10:48 UTC

    ❤️ Big shout out to @jholveck and @halldorfannar for this huge release. It will pave a brighter future for the project. Warm thank you to both of you.


    Python-MSS 10.2.0

    This is version 10.2.0 of Python-MSS, the ultra-fast cross-platform multiple screenshots module.

    Release date: 2026-04-23

    This release lays the groundwork for upcoming improvements planned for MSS 11.0, while remaining fully backward-compatible. It also improves performance, reliability, and multithreaded behavior, and introduces several new features for working with multi-monitor systems.

    If your code works with previous versions of MSS, it should continue to work unchanged in 10.2.0.


    Highlights

    New API

    In 10.2, MSS introduces a new API. The new design lets the MSS project introduce more significant internal changes, without introducing compatibility problems.

    Programs using the old API will continue to work in 10.2.0, and most of them will continue to work with 11.0 and beyond.

    Previously, MSS would provide the user with an OS-specific MSS class. In the new API, the user always sees a single class: mss.MSS.

    The existing mss.mss factory function will continue to work in 11.0, and will continue to work for as long as is reasonable. However, the mss.MSS constructor is preferred for new code.

    The existing mss.{platform}.MSS types are deprecated in 10.2.0. (This means the mss.darwin.MSS, mss.linux.MSS, and mss.windows.MSS classes.) They will continue to work. In 11.0, MSS will remove these classes, but to help with backwards compatibility, they will become deprecated factory functions, returning an instance of mss.MSS. Users who use mss.{platform}.MSS as functions can continue to do so. Users who use these as type declarations may update their code to use mss.MSS in 10.2, and may be required to do so in 11.0.

    Speaking of types, the MSSBase class is deprecated in 10.2.0. Most users won’t care about that, some type declarations may need to change to mss.MSS.

    Where possible, deprecated functionality emits a DeprecationWarning. However, note that these are ignored by default, unless triggered by code in __main__. If you want to see these DeprecationWarning messages, you may run your program under python -Wd, or with the environment variable PYTHONWARNINGS=default (or error). See the Python documentation chapter “Warning Control” for more details.

    Many of the API docs are removed, since this change removes much of the API surface. However, they are still in available for backwards-compatibility.

    Again, existing working code will continue to work in 10.2 unchanged. However, we recommend that users change the code and type declarations to use mss.MSS.

    Summary of deprecations:

    • mss.mss: Change to mss.MSS. Will continue to work in 11.0.
    • mss.{platform}.MSS: Change to mss.MSS. Code will continue to work in 11.0. Types will need to be changed by 11.0.
    • mss.base.MSSBase: (Only valid as a type) Change to mss.MSS by 11.0.

    With this change, we are also documenting the MSS versioning policy. MSS has always used Semantic Versioning, but the new policy clearly spells out the details.

    Demo Applications

    The repository now includes several full demo programs under demos/ showing common screenshot-processing workflows built on MSS.

    These examples are intended as learning resources and reference implementations. The demos include extensive comments explaining the pipeline architecture and performance considerations involved in real-world screenshot processing, as well as how to use MSS with several popular libraries.

    Included demos:

    Video Recorder

    Records the screen to a video file using MSS frames.

    TinyTV Streamer

    Streams the screen as

  2. v10.1.010.1.02025-08-16 · 2025-08-16 12:12 UTC
    查看更新说明

    :heart: contributors: @brycedrennan

    • 🚀 Mac: up to 60% performances improvement by taking screenshots at nominal resolution (e.g. scaling is off by default). To enable back scaling, set mss.darwin.IMAGE_OPTIONS = 0. (#257)
    • :scroll: docs: use the shibuya theme
  3. v10.0.02024-11-14 · 2024-11-14 09:37 UTC
    查看更新说明

    :heart: contributors: @kianmeng, @shravanasati, @mgorny

    • ⚠️ removed support for Python 3.8
    • 🐍 added support for Python 3.14 (#300)
    • 🐛 Linux: fixed a threadding issue in .close() when calling XCloseDisplay() (#251)
    • :gear: Linux: minor optimization when checking for a X extension status (#251)
    • 🧙 tweaked ruff rules (#306)
    • :scroll: improved the documentation (#284, #295)
  4. v9.0.22024-09-01 · 2024-09-01 10:35 UTC
    查看更新说明

    :heart: contributors: @Andon-Li

    • 🐍 added support for Python 3.13
    • 🚀 leveled up the packaging using hatchling
    • :mage: used ruff to lint the code base (#275)
    • 🐛 MSS: fixed Pixel model type (#274)
    • :gear: MSS: minor optimization when using an output file format without date (#275)
    • CI: automated release publishing on tag creation
  5. v9.0.19.0.12023-04-20 · 2023-04-20 05:47 UTC
    查看更新说明
    • 🐛 CLI: fixed entry point not taking into account arguments (#255)

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Python MSS

    PyPI version Anaconda version Tests Downloads

    [!TIP] Become my boss to help me work on this awesome software, and make the world better:

    Patreon

    from mss import MSS
    
    # The simplest use, save a screenshot of the 1st monitor
    with MSS() as sct:
        sct.shot()
    

    An ultra-fast cross-platform multiple screenshots module in pure python using ctypes.

    • Python 3.10+, PEP8 compliant, no dependency, thread-safe;
    • very basic, it will grab one screenshot by monitor or a screenshot of all monitors and save it to a PNG file;
    • but you can use PIL and benefit from all its formats (or add yours directly);
    • integrate well with Numpy and OpenCV;
    • it could be easily embedded into games and other software which require fast and platform optimized methods to grab screenshots (like AI, Computer Vision);
    • get the source code on GitHub;
    • learn with a bunch of examples;
    • you can report a bug;
    • need some help? Use the tag python-mss on Stack Overflow;
    • and there is a complete, and beautiful, documentation :)
    • MSS stands for Multiple ScreenShots;

    Installation

    You can install it with pip:

    python -m pip install -U --user mss
    

    Or you can install it with Conda:

    conda install -c conda-forge python-mss
    

    In case of scaling and high DPI issues for external monitors: some packages (e.g. mouseinfo / pyautogui / pyscreeze) incorrectly call SetProcessDpiAware() during import process. To prevent that, import mss first.