A simple Python project that generates a custom QR Code and embeds a logo at the center using the qrcode and Pillow libraries. This project demonstrates how to create visually appealing QR codes while maintaining their scannability.
- Generate QR codes for any website, text, or URL.
- Add a custom logo at the center of the QR code.
- Automatically resize the logo.
- Center the logo on the QR code.
- Supports transparent (RGBA) logos.
- Saves the generated QR code as an image.
- Python 3.x
- qrcode
- Pillow (PIL)
Install the required libraries:
pip install qrcode[pil]or
pip install qrcode pillowQR-Code-Generator/
โ
โโโ logo.png
โโโ qr_generator.py
โโโ qr_logo.png
โโโ README.md
- Install the required libraries.
- Add your logo image (
logo.png) to the project folder or provide the correct file path. - Update the URL inside the code.
- Run the Python script.
python qr_generator.pyThe generated QR code will be saved as:
qr_logo.png
import qrcode
from PIL import Image
img = qrcode.make("https://google.com").convert("RGB")
logo = Image.open("logo.png").resize((60,60))
x = (img.width - logo.width) // 2
y = (img.height - logo.height) // 2
img.paste(logo, (x,y), mask=logo if logo.mode=="RGBA" else None)
img.save("qr_logo.png")- Generates a QR code from the provided URL.
- Opens the logo image.
- Resizes the logo.
- Calculates the center position.
- Places the logo at the center.
- Saves the final QR code.
The program creates a QR code similar to this:
- โ QR Code
- โ Custom Logo in the Center
- โ Ready to Scan
- Generate colored QR codes.
- Add custom QR code styles.
- Create a graphical user interface (GUI).
- Accept user input for URLs.
- Generate QR codes in different formats (PNG, SVG).
Santhoshi M
๐ GitHub: https://github.com/Santhoshi2010