Skip to content

Instantly share code, notes, and snippets.

@tmthydvnprt
Created March 24, 2016 11:41
Show Gist options
  • Select an option

  • Save tmthydvnprt/884c07cdca6a4624969f to your computer and use it in GitHub Desktop.

Select an option

Save tmthydvnprt/884c07cdca6a4624969f to your computer and use it in GitHub Desktop.
create base64 image
import base64
with open("/path/to/your/image.png", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
print 'data:image/png;base64,'+encoded_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment