imagecapture ([<window name>, [<output file>, (opt)<width-x>, (opt)<height-y>, (opt)x, (opt)y]])
Capture snap-shot of the window. Where startx & starty are offset. If window name is not provided, then the complete X screen is captured. If output file name is not provided, then a temporary file will be created and the file name will be returned. File has to be explicitly deleted by the user.
Refer: http://cgit.freedesktop.org/ldtp/ldtp/tree/python/ldtputils.py
from ldtputils import *
imagecapture ('Terminal', 'out.png') # out.jpg will be created in current directory. Give absolute path to save it in some other directory.
imagecapture () # Captures the complete X screen and saves in a temp file and returns the file name.
Digwin binary - http://sourceforge.net/projects/ltfx If a specific window has to be captured, then digwin is used to get the window id.
Import utility of ImageMagick - http://www.imagemagick.org/script/import.php # Mandatory dependency, if you want to use this function.