def imagecapture(self, window_name=None, out_file=None, x=<NUM_LIT:0>, y=<NUM_LIT:0>,<EOL>width=None, height=None):
if not out_file:<EOL><INDENT>out_file = tempfile.mktemp('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>out_file = os.path.expanduser(out_file)<EOL><DEDENT>if _ldtp_windows_env:<EOL><INDENT>if width == None:<EOL><INDENT>width = -<NUM_LIT:1><EOL><DEDENT>if height == None:<EOL><INDENT>height = -<NUM_LIT:1><EOL><DEDENT>if window_name == None:<EOL><INDENT>window_name = '<STR_LIT>'<EOL><DEDENT><DEDENT>data = self._remote_imagecapture(window_name, x, y, width, height)<EOL>f = open(out_file, '<STR_LIT:wb>')<EOL>f.write(b64decode(data))<EOL>f.close()<EOL>return out_file<EOL>
Captures screenshot of the whole desktop or given window

@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param x: x co-ordinate value
@type x: integer
@param y: y co-ordinate value
@type y: integer
@param width: width co-ordinate value
@type width: integer
@param height: height co-ordinate value
@type height: integer

@return: screenshot filename
@rtype: string