I want to make a python screenshot taker, so i tried to make it take screenshots, and i thought that i could just f.write(NewByteArray), but it didn't work, i got some errors, here:
Traceback (most recent call last):
File "C:\Users\*******\OneDrive\Área de Trabalho\Meu Computador\Programas\Python\GC YT Maker\Gacha Club Screenshot taker.py", line 22, in <module>
BiteArray = bytearray(image)
TypeError: cannot convert 'PngImageFile' object to bytearray
and i don't know what to do anymore, here's all my code btw:
import os
import sys
import pyautogui
import pyscreenshot
from PIL import Image
SCREEN_X1 = 10
SCREEN_Y1 = 10
# X1 Position of the background
# Y1 Position of the background
SCREEN_X2 = 255
SCREEN_Y2 = 255
# X2 Position of the background
# Y2 Position of the background
Filename = 0
FILENAME = f'{Filename}.png'
image = pyscreenshot.grab(bbox=(SCREEN_X1, SCREEN_Y1, SCREEN_X2, SCREEN_Y2))
#image.show()
BiteArray = bytearray(image)
with open(FILENAME, 'wb') as f:
f.write(BiteArray)
f.close
Filename += 1