LDTP
3.5.0
|
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: Linux: http://cgit.freedesktop.org/ldtp/ldtp2/tree/ldtp/generic.py
Mac: https://github.com/ldtp/pyatom/blob/master/atomac/ldtpd/generic.py
Windows: https://github.com/ldtp/cobra/blob/master/Ldtpd/Screenshot.cs
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.
Import utility of ImageMagick - Linux: http://www.imagemagick.org/script/import.php # Mandatory dependency, if you want to use this function.