So MSS can be used as simply as:

from mss import mss

Or import the good one base on your operating system:

# MacOS X
from mss.darwin import MSS as mss

# GNU/Linux
from mss.linux import MSS as mss

# Microsoft Windows
from import MSS as mss


So the module can be used as simply as:

with mss() as sct:
    # ...

Intensive Use

If you plan to integrate MSS inside your own module or software, pay attention to using it wisely.

This is a bad usage:

for _ in range(100):
    with mss() as sct:

This is a much better usage, memory efficient:

with mss() as sct:
    for _ in range(100):

Also, it is a good thing to save the MSS instance inside an attribute of you class and calling it when needed.


On GNU/Linux, you can specify which display to use (useful for distant screenshots via SSH):

with mss(display=":0.0") as sct:
    # ...

A more specific example to only target GNU/Linux:

import mss

with mss.mss(display=":0.0") as sct:
    for filename in

Command Line

You can use mss via the CLI:

mss --help

Or via direct call from Python:

python -m mss --help

New in version 3.1.1.