Skip to content

Instantly share code, notes, and snippets.

@dperaltab
Created April 22, 2017 05:13
Show Gist options
  • Save dperaltab/cea9c57ce66792f6bf1173b9fcd7afe3 to your computer and use it in GitHub Desktop.
Save dperaltab/cea9c57ce66792f6bf1173b9fcd7afe3 to your computer and use it in GitHub Desktop.
import base64
read_file = open('/tmp/newgalax.png', 'rb')
data = read_file.read()
b64 = base64.b64encode(data)
print (b64)
# Save file
decode_b64 = base64.b64decode(b64)
out_file = open('/tmp/out_newgalax.png', 'wb')
out_file.write(decode_b64)
# Test in python 3.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment