This didnt work. Can you please help me out?
payload = { “imageUrl”: base64.b64encode(open("/path/to/pic/bot.jpg", “rb”).read()) }
with open(’/path/to/pic/bot.jpg’, ‘rb’) as f: image_data = f.read() base64_str = base64.b64encode(image_data) payload = { “imageUrl”: ‘data:image/jpeg;base64,’ + base64_str.decode(‘utf-8’)}
Join in the discussion - add comment below:
with open(’/path/to/pic/bot.jpg’, ‘rb’) as f:
image_data = f.read()
base64_str = base64.b64encode(image_data)
payload = { “imageUrl”: ‘data:image/jpeg;base64,’ + base64_str.decode(‘utf-8’)}