Skip to content

Instantly share code, notes, and snippets.

@lubianat
Created March 22, 2023 20:07
Show Gist options
  • Save lubianat/8d11903fd0d40684df6219e167c2bbcf to your computer and use it in GitHub Desktop.
Save lubianat/8d11903fd0d40684df6219e167c2bbcf to your computer and use it in GitHub Desktop.
Create a QR Code using Python
import qrcode
# the link that you want to convert into a QR code
link = "https://lubianat.github.io/natal_bioinformatics2wikidata/"
# create a QR code instance
qr = qrcode.QRCode(version=1, box_size=10, border=5)
# add data to the QR code instance
qr.add_data(link)
# make the QR code instance fit the data
qr.make(fit=True)
# create an image from the QR code instance
img = qr.make_image(fill_color="black", back_color="white")
# save the image as a PNG file
img.save("qr_code.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment