Skip to content

hejibo/pyscreenshot

 
 

Repository files navigation

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:
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

# one or more
sudo apt-get install scrot
sudo apt-get install imagemagick
sudo apt-get install python-gtk2
sudo apt-get install python-qt4
sudo apt-get install python-wxversion

# Python Imaging Library (required)
sudo apt-get install python-imaging

sudo apt-get install python-pip
sudo pip install pyscreenshot

Uninstall

# as root
pip uninstall pyscreenshot