This Python script generates a static QR code from a given URL and can optionally embed an image (such as a logo) at the center of the QR code.
- Generate a QR code from any URL
- Optionally embed an image (logo) in the center of the QR code
- Save the QR code as a PNG file
Install the required dependencies:
pip install qrcode[pil] Pillowpython generate_qrcode.py <url> [--logo <image_path>] [--output <output_file>]<url>: The URL to encode in the QR code (required)--logo <image_path>: Path to the image to embed in the center of the QR code (optional)--output <output_file>: Output file name (default:qrcode.png)
Generate a simple QR code:
python generate_qrcode.py "https://example.com"Generate a QR code with a logo embedded:
python generate_qrcode.py "https://example.com" --logo logo.png --output myqrcode.png- The embedded image should ideally be a PNG with a transparent background for best results.
- The script automatically resizes the logo to fit nicely within the QR code.
MIT