Reputation: 39
I'm using pyautogui to screenshot my current screen and I want to know if access to that image is possible via clipboard for further processing? Code:
import pyautogui
import time
x = 1
while x < 4:
capture = pyautogui.screenshot('/Users/Desktop/Screen/image'+str(x)+'.png')
x += 1
time.sleep(2)
Thanks.
Upvotes: 3
Views: 2399
Reputation: 1283
Yes, the pasting is possible. In general, to utilize the image, it may be converted to a cv2 image array for further processing using OpenCv:
import pyautogui
import time
import cv2
import numpy as np
x = 1
while x < 4:
capture = pyautogui.screenshot('saved_'+str(x)+'.png')
capture = cv2.cvtColor(np.array(capture), cv2.COLOR_RGB2BGR)
cv2.imshow("image",capture)
cv2.waitKey(0)
x += 1
time.sleep(2)
Upvotes: 3