Closed atilamagalhaes4 closed 3 years ago
I haven't tested it, but it's worth a try. Although I don't think it's going to work. Let us know.😄
Hey @atilamagalhaes4, You can use this
import base64
img_data = "data:image/jpg;base64,///sdasdasda....."
IMAGE = img_data.split(",")
extension = IMAGE[0].split(";")
with open(f"Picture.{extension[0].split('/')[1]}", "wb") as f:
f.write(base64.decodebytes(bytes(IMAGE[1], "utf-8")))
The picture will be first written to a file for which the extension will be determined by the data passed in. After that you can use the sendwhats_image
function to send this file to the contact. Thanks
b64 = "data:image/jpg;base64,///sdasdasda....." ex: pywhatkit.send_file("+919876543210",b64",15,00).