Skip to main content

The pyscreenshot module can be used to copy the contents of the screen to a PIL image memory or file. Replacement for the ImageGrab Module, which works on Windows only.

Links:
Goal:

Pyscreenshot tries to allow to take screenshots without installing 3rd party libraries. It is cross-platform but useful for Linux based distributions. It is only a pure Python wrapper, a thin layer over existing back-ends. Its strategy should work on most Linux distributions: a lot of back-ends are wrapped, if at least one exists then it works, if not then one back-end should be installed. Performance and interactivity are not important for this library.

Features:
Known problems:
  • not implemented: Capturing an active window

  • different back-ends generate slightly different images from the same desktop, this should be investigated

  • ImageMagick creates blackbox on some systems

  • PyGTK back-end does not check $DISPLAY -> not working with Xvfb

  • slow: 0.2s - 0.7s

Similar projects:

Usage

Example:

import pyscreenshot as ImageGrab

# fullscreen
im=ImageGrab.grab()
im.show()

# part of the screen
im=ImageGrab.grab(bbox=(10,10,500,500))
im.show()

# to file
ImageGrab.grab_to_file('im.png')

Installation

General

  • install pip

  • install PIL

  • install at least one back-end

  • install the program:

    # as root
    pip install pyscreenshot

Ubuntu

sudo apt-get install python-pip
sudo pip install pyscreenshot
sudo apt-get install python-imaging
# optional back-ends
sudo apt-get install scrot
sudo apt-get install imagemagick
sudo apt-get install python-gtk2
sudo apt-get install python-qt4
# optional for examples
sudo pip install entrypoint2

Uninstall

# as root
pip uninstall pyscreenshot

Metadata

Release files for pyscreenshot 0.3.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 pyscreenshot 0.3.0
File Size Uploaded
pyscreenshot-0.3.0.tar.gz 9.2 kB Details

Release files / pyscreenshot-0.3.0.tar.gz

Download URL pyscreenshot-0.3.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
82102b59883281f908dd843eb46e5427cfdef17db2bb7ebb4dfd77705cef6f24
BLAKE2b-256 checksum
How to use checksums
6b345aab67f09ef350033e04de47ffd3bd92f92e8fcbe540177e14edb599678c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.1

2 release files

3.0

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.0

2 release files

0.6

2 release files

0.5.1

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

This release

0.3.0 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

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