Small command-line helper that turns a URL (or any text) into an image-based QR code using the qrcode Python library.
- Python 3.8 or newer
pipfor installing dependencies
python -m venv .venv
.venv\Scripts\activate # On macOS/Linux use: source .venv/bin/activate
pip install qrcode[pil]python generator.pyYou'll be prompted for:
URL: Any text or link that should be encodedfilename: The output image name (saved as<filename>.jpg)
Example:
Enter your URL: https://example.com
Enter the filename: example-qr
QR-Code generated!
The QR image is saved alongside the script, e.g. example-qr.jpg.
- Adjust the QR appearance (size, colors, error correction) by tweaking the arguments passed to
qrcode.QRCodeingenerator.py. - Replace
.jpgwith.pngin the finalgeneratecall if you prefer PNG output.
- ModuleNotFoundError: No module named 'qrcode'
Ensure the virtual environment is activated and rerunpip install qrcode[pil].
Enjoy creating quick QR codes for links, Wi-Fi credentials, and more!