Skip to content

Instantly share code, notes, and snippets.

@raghavmri
Created December 7, 2021 15:47
Show Gist options
  • Select an option

  • Save raghavmri/5ea63001c05292ab61f3595078706ac4 to your computer and use it in GitHub Desktop.

Select an option

Save raghavmri/5ea63001c05292ab61f3595078706ac4 to your computer and use it in GitHub Desktop.
A simple QR generator using python
import pyqrcode # pip install pyqrcode
# pip install pypng
# you need to install pypng if you want to convert the qr code to png
import png
# This creates a QR code for our youtube channel
# Can be any text or URL
QRCode = pyqrcode.create(
'https://www.youtube.com/channel/UC5GG_qSQ2OgROyc0fRo0KzQ')
print(QRCode.text(quiet_zone=1)) # Prints the QR code as text
print(QRCode.terminal(quiet_zone=1)) # Prints the QR code to the terminal
QRCode.png_as_base64_str(scale=6) # Creates a PNG file as a base64 string
QRCode.png('QRCode.png', scale=6) # Creates a PNG file
QRCode.svg('QRCode.svg', scale=8) # Creates an SVG file
QRCode.eps('QRCode.eps', scale=2) # Creates an EPS file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment