I have a project to generate qr code with logo in center of qr code. How I can make it like this.
now I'm use django-qr-code to generate text qr code but I need qr code with logo in center.
I have a project to generate qr code with logo in center of qr code. How I can make it like this.
now I'm use django-qr-code to generate text qr code but I need qr code with logo in center.
If you use a high-redundancy algorithm (eg H), you can damage the generated QRCode up to a certain percentage. H means you can cover 30% of the data and it'll still work.
That means it's just a case of placing your image over the code. The format is up to you.
import pyqrcode
from PIL import Image
url = pyqrcode.QRCode('http://www.eqxiu.com',error = 'H')
url.png('test.png',scale=10)
im = Image.open('test.png')
im = im.convert("RGBA")
logo = Image.open('logo.png')
box = (135,135,235,235)
im.crop(box)
region = logo
region = region.resize((box[2] - box[0], box[3] - box[1]))
im.paste(region,box)
im.show()