Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
badgie/vCard-QR.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (20 sloc)
945 Bytes
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
import qrcode | |
# This is a piece of code to generate a VR code. If you want to use this for badger, you'll need to also do the following - | |
# - reduce the image to 1 bit | |
# - resize the qr code to 104x104 | |
# - resize the canvas to 104 x 128 | |
# - convert to a bin blob () using convert.py ("convert.py --binary qr.png") | |
# - load it into the images directory on the badge | |
# HINT - encoding a comblete VCARD as given below often ends up with something unreadable on the badge - better to have your contact | |
# details online and the QR code just point to them (Android prefers it what way as well) | |
vcard = '''BEGIN:VCARD | |
VERSION:3.0 | |
N:Mitchell;Faye;;Dr; | |
FN:Faye Mitchell | |
ORG:Coventry University; | |
TITLE:Acting Head of School | |
EMAIL;type=INTERNET;type=WORK;type=pref:ac9207@coventry.ac.uk | |
END:VCARD''' | |
img = qrcode.make('https://linuxlady.coventry.domains/Dr-Faye-Mitchell---Contact-Information') | |
type(img) # qrcode.image.pil.PilImage | |
img.save("qr.png") |