第一种qrcode
import qrcode # Link for website input_data = "https://www.cnblogs.com/hightech/" #Creating an instance of qrcode qr = qrcode.QRCode( version=1, box_size=10, border=5) qr.add_data(input_data) qr.make(fit=True) img = qr.make_image(fill='black', back_color='white') img.save('qrcode001.png')
第二种 myqr
from MyQR import myqr """生成一个二维码""" myqr.run(words='https://laxous.github.io/HuaBro.github.io/', save_name='001.jpg', ) """生成带背景图片的二维码""" myqr.run(words='https://laxous.github.io/HuaBro.github.io/', picture=r'bg.png', colorized=True, # True:彩色,False:黑白 save_name='002.png', ) """生成动态图二维码""" myqr.run(words='https://laxous.github.io/HuaBro.github.io/', picture='test.gif', colorized=True, save_name='test-2.gif', )