Created
December 15, 2020 07:40
-
-
Save fasalmbt/6386c93fbfbd1d9461b99c1cd3e9c068 to your computer and use it in GitHub Desktop.
Generate QR Codes
This file contains hidden or 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
#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