commit 760fbf68e7df932efa321c91b215935a2b328824 Author: Dominic DiTaranto Date: Mon Mar 9 12:13:33 2026 -0400 init commit diff --git a/main.py b/main.py new file mode 100644 index 0000000..09fe90a --- /dev/null +++ b/main.py @@ -0,0 +1,42 @@ +import argparse +import qrcode + +from PIL import Image + + +def generate_qr_code(url, name): + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_H, + box_size=50, + border=1, + ) + + qr.add_data(url) + qr.make(fit=True) + + img = qr.make_image(fill_color="black", back_color="white") + + overlay = Image.open("static/rs_koc.webp") + + if overlay.mode != 'RGBA': + overlay = overlay.convert('RGBA') + if img.mode != 'RGBA': + img = img.convert('RGBA') + + img.paste(overlay, (420, 420), overlay) + + output_path = f"output/{name}.png" + img.save(output_path) + + print(f"QR Code generated at: {output_path}") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('url', help="URL for the QR code") + parser.add_argument('name', help="Name of the file, do not include extension") + + args = parser.parse_args() + + generate_qr_code(args.url, args.name) diff --git a/output/test.png b/output/test.png new file mode 100644 index 0000000..11329dd Binary files /dev/null and b/output/test.png differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5f9d350 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pillow==12.1.1 +qrcode==8.2 diff --git a/static/rs_koc.webp b/static/rs_koc.webp new file mode 100644 index 0000000..478327e Binary files /dev/null and b/static/rs_koc.webp differ