app.py
`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import qrcode # Text to encode data = "https://freemediatools.com" # Replace this with any text or URL # Generate QR Code qr = qrcode.QRCode( version=1, # size of the QR code (1-40), 1 is smallest error_correction=qrcode.constants.ERROR_CORRECT_H, # High error correction box_size=10, # size of each box in pixels border=4, # thickness of the border (minimum is 4) ) qr.add_data(data) qr.make(fit=True) # Create and save the image img = qr.make_image(fill_color="yellow", back_color="black") img.save("qrcode.png") print("QR code saved as 'qrcode.png'") |