Skip to main content

Fork of pyscreenshot for RPA use

Project description

The pyscreenshot module can be used to copy the contents of the screen to a PIL or Pillow image memory using various back-ends. Replacement for the ImageGrab Module, which works on Windows only, so Windows users don’t need this library. For handling image memory (e.g. saving to file, converting,..) please read PIL or Pillow documentation.

Links:

Travis Coveralls Latest Version Supported Python versions License Documentation

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.

Features:
Known problems:
Similar projects:

Examples

grab and show the whole screen:

#-- include('examples/showgrabfullscreen.py') --#
import pyscreenshot as ImageGrab

if __name__ == '__main__':

    # grab fullscreen
    im = ImageGrab.grab()

    # save image file
    im.save('screenshot.png')

    # show image in a window
    im.show()
#-#

to start the example:

python3 -m pyscreenshot.examples.showgrabfullscreen

grab and show the part of the screen:

#-- include('examples/showgrabbox.py')--#
import pyscreenshot as ImageGrab

if __name__ == '__main__':
    # part of the screen
    im = ImageGrab.grab(bbox=(10, 10, 510, 510))  # X1,Y1,X2,Y2
    im.show()
#-#

to start the example:

python3 -m pyscreenshot.examples.showgrabbox

Installation

  • install Pillow (Ubuntu: sudo apt-get install python3-pil)

  • install at least one back-end

  • install the program:

    pip3 install pyscreenshot

Command line interface

Back-end performance:

The performance can be checked with pyscreenshot.check.speedtest.

Example:

#-- sh('python3 -m pyscreenshot.check.speedtest --virtual-display 2>/dev/null') --#

n=10
------------------------------------------------------
scrot                 6.1  sec        (  608 ms per call)
imagemagick           9.7  sec        (  969 ms per call)
wx                    4.1  sec        (  408 ms per call)
pygdk3                3.3  sec        (  328 ms per call)
qtpy                  6.9  sec        (  687 ms per call)
pyqt5                 6.9  sec        (  687 ms per call)
pyqt                  6.4  sec        (  644 ms per call)
pyside2               6.7  sec        (  671 ms per call)
pyside                6.5  sec        (  652 ms per call)
gnome-screenshot      12   sec        ( 1209 ms per call)
#-#

Print versions:

#-- sh('python3 -m pyscreenshot.check.versions 2> /dev/null ')--#
python               3.7.3
pyscreenshot         0.7
scrot                1.1.1
imagemagick          6.9.10
wx                   4.0.4
pygdk3               3.32.0
qtpy                 1.3.1
pyqt5                5.12.1
pyqt                 4.12.1
pyside2              5.11.2
pyside               1.2.2
pygtk                missing
gnome-screenshot     3.30.0
#-#

Wayland

On Wayland only the gnome-screenshot back-end works:

im = ImageGrab.grab(backend='gnome-screenshot')

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

rpaframework-screenshot-0.1.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

rpaframework_screenshot-0.1.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file rpaframework-screenshot-0.1.0.tar.gz.

File metadata

  • Download URL: rpaframework-screenshot-0.1.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.0 Darwin/19.4.0

File hashes

Hashes for rpaframework-screenshot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 707f675a81b2bd65f598e58fea95207690c8f86128dd1c870b8ee7fba4b7f7e0
MD5 30f330492f8721840ec5627da4663a83
BLAKE2b-256 9f05bb2af3a289300acef691e16406a06d4a25d0f954c6275c80ad6d2bdd1347

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for rpaframework_screenshot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 251c4f13a43390b9eb72b1d150a42caf88bcbeb5deb6392de38672bd9ce481e5
MD5 cccb8beb0318835968f8c8b9f2f52bad
BLAKE2b-256 8a6444e17e9871c35c2d79e4c2508d596979b3725b6dc9c1bf7bcda4c6f27580

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page