Created
December 4, 2020 15:42
-
-
Save Geekgineer/c3106045f09e847751825a099c56ef0e to your computer and use it in GitHub Desktop.
Capture Image from screenshot buffer and encoded to base64 or to numpy array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
from base64 import b64encode | |
import pyscreenshot as ImageGrab | |
buffer = BytesIO() | |
im=ImageGrab.grab() | |
im.save(buffer, format='PNG') | |
im.close() | |
b64_str = b64encode(buffer.getvalue()) | |
# Numpy Image | |
# im=im.convert('RGB') | |
# im = numpy.array(im) |
Author
Geekgineer
commented
Jan 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment