Simple Python CLI tool to generate a QR code image from a URL or any text string.
- Python 3.8+
qrcodepackage (with Pillow support)
Install dependency:
pip install "qrcode[pil]"Run the script with:
python url_gen.py <url_or_text> <output_filename>Example:
python url_gen.py "https://example.com" "example-qr.png"- Files are always saved in the
.output/directory. - The script uses only the file name part of
output_filename. - If
.output/does not exist, it is created automatically.
After generation, the script prints the saved path, for example:
QR code saved to .output/example-qr.png
- Input can be a URL or plain text.
- Current QR generation settings in
url_gen.py:version=1error_correction=ERROR_CORRECT_Lbox_size=20border=2