Created
August 31, 2013 16:03
-
-
Save datermine/6399150 to your computer and use it in GitHub Desktop.
A little util for opening an image and then outputting it as as base64 string.
This file contains hidden or 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
| import base64 | |
| filename = "bg_gosling.jpg" | |
| encoded_data = base64.encodestring(open(filename, "rb").read()) | |
| # Optionally view encoded_data to verify it worked | |
| text_file = open("out.txt", "w") | |
| text_file.write(encoded_data) | |
| text_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment