Skip to content

Instantly share code, notes, and snippets.

@meehow
Created February 2, 2018 10:31
Show Gist options
  • Save meehow/720a7d7f8e74cd6bc94596e86b63f421 to your computer and use it in GitHub Desktop.
Save meehow/720a7d7f8e74cd6bc94596e86b63f421 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# coding=utf-8
import base64
import cStringIO
import qrcode
import sys
if __name__ == "__main__":
buf = cStringIO.StringIO()
qrcode.make(sys.argv[1], error_correction=qrcode.ERROR_CORRECT_Q, border=1).save(buf)
print 'data:image/png;base64,' + base64.b64encode(buf.getvalue())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment