LDTP  3.5.0
 All Pages
imagecapture

Syntax

imagecapture([<window name>, [<output file>,(opt)<width-x>,(opt)<height-y>,(opt)x,(opt)y]])

Description

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.

ImplementationDetails

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

Example

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.

Note
Window title name is case sensitive

Dependency

Import utility of ImageMagick - Linux: http://www.imagemagick.org/script/import.php # Mandatory dependency, if you want to use this function.

Author
Nagashree mnaga.nosp@m.shre.nosp@m.e@nov.nosp@m.ell..nosp@m.com


Linux Desktop Testing Project