I want to have a python script that can take a screenshot without saving it directly to the disk immediately. Basically is there a module with a function that returns the raw bytes that I can then write into a file by myself manually?
import some_screenshot_module
raw_data = some_screenshot_module.return_raw_screenshot_bytes()
f = open('screenshot.png','wb')
f.write(raw_data)
f.close()
I have already checked out mss, pyscreenshot and PIL yet I could not find what I needed. I found a function that looked like what I was looking for, called frombytes. However after retrieving the bytes from the frombytes function and saving it into a file I couldn't view it not as a .BMP,.PNG,.JPG. Is there a function that returns the raw bytes that I can save into a file by myself or perhaps a module with a function like that?