I want to take a screenshot of the screen and save it to a buffer as a photo(X.jpg
) and later I can use the cv2(opencv)
to read the same image from the buffer.
i act as follow:
Edit My code:
from PIL import ImageGrab
from io import BytesIO
ii = ImageGrab.grab()
with BytesIO() as output:
ii.save(output,format="JPEG")# This line has an error
cam = output.getvalue()
result, frame = cv2.imencode('.jpg', cam, encode_param)
i get this Errors:
TypeError: img is not a numpy array, neither a scalar
thank you