Ultra fast cross-platform multiple screenshots module in pure Python

ankitg121 pts0 comments

Python MSS latest documentation

Python MSS

Installation<br>Recommended Way<br>Conda Package

From Sources

Usage<br>Import

Intensive Use

Multithreading

Backends<br>GNU/Linux<br>Display

Backends

Command Line

Examples<br>Basics<br>One screenshot per monitor

Screenshot of the monitor 1

A screenshot to grab them all

Callback

Part of the screen

Part of the screen of the 2nd monitor

Use PIL bbox style and percent values

PNG Compression

Get PNG bytes, no file output

Advanced<br>Custom ScreenShot Subclass

GNU/Linux XShm backend

PIL<br>Playing with pixels

OpenCV/Numpy

FPS<br>Benchmark

Multiprocessing

BGRA to RGB

Demos

Support<br>Future

Others

Abandoned

MSS API<br>Core Package<br>MSS<br>MSS.compression_level

MSS.close()

MSS.grab()

MSS.monitors

MSS.primary_monitor

MSS.save()

MSS.shot()

MSS.performance_status

MSS.max_displays

MSS.with_cursor

ScreenShot<br>ScreenShot.raw

ScreenShot.pos

ScreenShot.size

ScreenShot.from_size()

ScreenShot.bgra

ScreenShot.pixels

ScreenShot.pixel()

ScreenShot.rgb

ScreenShot.top

ScreenShot.left

ScreenShot.width

ScreenShot.height

ScreenShotError<br>ScreenShotError.details

mss()

Data Models<br>Pos<br>Pos.left

Pos.top

Size<br>Size.width

Size.height

Developers<br>Setup

Testing<br>Dependency

How to Test?

Code Quality

Documentation

XCB Code Generator

Versioning<br>Overview

Public API

Compatibility Rules<br>Changes That Require a Major Version

Changes That Do Not Require a Major Version

Deprecation Policy

Feature Gating

Typing and Compatibility

Stability Guidelines

Writing Forward-Compatible Code

Philosophy

History<br>Python-MSS 10.2.0<br>Highlights<br>New API

Demo Applications

Richer Monitor Metadata

Multithreading Improvements

Improved Linux Capture Backend

Windows Improvements

Restructure

macOS Stability Fix

Deprecations and Upcoming Changes (Planned for 11.0)<br>Python 3.9 EOL

Deprecated Attribute

Screenshot Class Changes

Monitor Objects

bgra Return Type

cls_image Constructor Behavior

Internal Platform Attributes<br>Windows

macOS

Python-MSS v10.1.0

Python-MSS v10.0.0

Python-MSS v9.0.2

Python-MSS v9.0.1

Python-MSS v9.0.0

Python-MSS v8.0.3

Python-MSS v8.0.2

Python-MSS v8.0.1

Python-MSS v8.0.0

Python-MSS v7.0.1

Python-MSS v7.0.0

Python-MSS v6.1.0

Python-MSS v6.0.0

Python-MSS v5.1.0

Python-MSS v5.0.0

Python-MSS v4.0.2

Python-MSS v4.0.1

Python-MSS v4.0.0

Python-MSS v3.3.2

Python-MSS v3.3.1

Python-MSS v3.3.0

Python-MSS v3.2.1

Python-MSS v3.2.0

Python-MSS v3.1.2

Python-MSS v3.1.1

Python-MSS v3.1.0

Python-MSS v3.0.1

Python-MSS v3.0.0

Python-MSS v2.0.22

Python-MSS v2.0.18

Python-MSS v2.0.0

Python-MSS v1.0.2

Python-MSS v1.0.1

Python-MSS v1.0.0

Python-MSS v0.1.1

Python-MSS v0.1.0

Python-MSS v0.0.8

Python-MSS v0.0.7

Python-MSS v0.0.6

Python-MSS v0.0.5

Python-MSS v0.0.4

Python-MSS v0.0.3

Python-MSS v0.0.2

Python-MSS v0.0.1

Who Uses it?

On this page

Welcome to Python MSS’s documentation!

Indices and tables

python-mss

Edit this page

Python MSS

Welcome to Python MSS’s documentation!

Welcome to Python MSS’s documentation!¶

from mss import MSS

# The simplest use, save a screenshot of the 1st monitor<br>with MSS() as sct:<br>sct.shot()

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

Python 3.9+ , PEP 8 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 ;

MSS stands for Multiple ScreenShots;

Content

Installation

Usage

Examples

Support

MSS API

Developers

Versioning

History

Who Uses it?

Indices and tables¶

Index

Search Page

Back to top

Next<br>Installation

python screenshot monitor documentation platform screenshots

Related Articles