Skip to content

Instantly share code, notes, and snippets.

@fasalmbt
Created December 15, 2020 07:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasalmbt/6386c93fbfbd1d9461b99c1cd3e9c068 to your computer and use it in GitHub Desktop.
Save fasalmbt/6386c93fbfbd1d9461b99c1cd3e9c068 to your computer and use it in GitHub Desktop.
Generate QR Codes
#QRCode geneartion made easy
import os
import pyqrcode
from PIL import Image
class QRCode(object):
def __init__(self,text):
self.qr_image = self.qr_generator(text)
@staticmethod
def qr_generator(text):
qr_code = pyqrcode.create(text)
file_name = "kyuaar"
save_path = os.path.join(os.path.expanduser('~/Desktop/'),file_name) #replace with location you prefer
name = f"{save_path}.png"
qr_code.png(name,scale=10)
image = Image.open(name)
image = image.resize((400,400),Image.ANTIALIAS)
image.show()
if __name__ == "__main__":
QRCode(input("Enter a link >> "))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment