Created
February 28, 2016 10:17
-
-
Save oglops/2a5930659eb7de88ba04 to your computer and use it in GitHub Desktop.
convert image file to base64 string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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