I have got pyscreenshot (+ gtkpixbuf ) to do this activiy.
Code in gtkpixbuf.py as follows:
Code in gtkpixbuf.py as follows:
# http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux from PIL import Image import tempfile # based on: class GtkPixbufWrapper(object): name = 'pygtk' childprocess = False def __init__(self): import gtk self.gtk = gtk try: gtk.gdk.Pixbuf gtk.gdk.COLORSPACE_RGB except AttributeError: raise ImportError( 'Incompatible with Python3 / GDK3. Use gdk3pixbuf.') def grab(self, bbox=None): f = tempfile.NamedTemporaryFile( suffix='.png', prefix='pyscreenshot_gtkpixbuf_') filename = f.name self.grab_to_file(filename, bbox) im = Image.open(filename) return im def grab_to_file(self, filename, bbox=None): """http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html. only "jpeg" or "png" """can anyone help how to invoke pyscreenshot and gtkpixbuf to get the screenshot of a given unix file