The pyscreenshot module can be used to copy the contents of the screen to a PIL or Pillow image memory. Replacement for the ImageGrab Module, which works on Windows only. For handling image memory (e.g. saving to file, converting,..) please read PIL or Pillow documentation.
- 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.
Capturing the whole desktop
Capturing an area
some back-ends are based on this discussion: http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux
pure Python library
supported python versions: 2.6, 2.7
- Known problems:
- Similar projects:
import pyscreenshot as ImageGrab # fullscreen im=ImageGrab.grab() im.show() # part of the screen im=ImageGrab.grab(bbox=(10,10,510,510)) # X1,Y1,X2,Y2 im.show()
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
# as root pip uninstall pyscreenshot