Skip to content

Instantly share code, notes, and snippets.

@jtemporal
Created June 14, 2018 14:41
Show Gist options
  • Save jtemporal/513cb095ad6bf92b38cfdb420e986aa2 to your computer and use it in GitHub Desktop.
Save jtemporal/513cb095ad6bf92b38cfdb420e986aa2 to your computer and use it in GitHub Desktop.
read image bytes and turn it into base64 string
import base64
with open('test_img.png', 'rb') as img_data:
img = img_data.read()
print(base64.encodebytes(img).decode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment