Skip to content

Instantly share code, notes, and snippets.

@oglops
Created February 28, 2016 10:17
Show Gist options
  • Save oglops/2a5930659eb7de88ba04 to your computer and use it in GitHub Desktop.
Save oglops/2a5930659eb7de88ba04 to your computer and use it in GitHub Desktop.
convert image file to base64 string
#!/usr/bin/env python
import sys
import base64
with open(sys.argv[1], "rb") as imageFile:
img_str = base64.b64encode(imageFile.read())
print img_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment