1
Personal I’m taking 1 photo from the database but it’s coming as base 64 , that I need it to turn image again to be able to locate on the screen , how do I turn the base 64 into Bites again? I tried to make a mistake
agua = str(dataBase.read_fotos("foto", "agua", "1"))
agua = agua[4:]
agua = agua[:-4]
img_agua = base64.b64decode(agua)
rod = str(dataBase.read_fotos("foto", "vara", "1"))
rod = rod[4:]
rod = rod[:-4]
img_rod = base64.b64decode(rod)
# -------------------------------encontrar posições--------------------
water_position = pyautogui.locateOnScreen(img_agua)
rod_position = pyautogui.locateOnScreen(img_rod)
AttributeError: 'bytes' object has no attribute 'mode'
right, but this variable with bytes, is encoded in base 64, what I needed was to switch to bytes, you think Pil would work for my case ?
– Patrick issler
It would not be the case to use
bytearray(sua_variavel_base_64)
?– Paulo Marques
I tried this way he gave the following error
– Patrick issler
img_agua = bytearray(agua) Typeerror: string argument without an encoding
– Patrick issler
Try
bytes(sua_variavel, encoding='utf8')
. If it doesn’t work, put the content of your variable in a gist and update your post.– Paulo Marques