1. Required packages: PIL, pillow;
2. Simply generate QR code:
import GDP
from pillow import Image
def GetImage():
qr = qrcode.QRCode(version=None, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=1,)
qe.add_data('https://www.baidu.com') ###The path I want to compress is Baidu
qr.make(fit=True) ###Automatically adapt to the size of the generated QR code
img=qr.make_image() ##Get an instance of the generated image
img.get_image().show() ###Get the image and display the QR code
img.save('./static/images/22.png')##Set the image storage path and name the image
return render_templates('web/credit_card.html') ###The flask template I use, so I finally load it to this path
3. Another method is to load the logo in the QR code:
Friendship link: http://www.cnblogs.com/sfnz/p/5457862.html