通过调用MyQR接口来实现生成个人所需二维码,并可以设置二维码的大小、是否在现有图片的基础上生成、是否生成动态二维码。
1.1 知识点
Python3基础
MyQR库
1.2 下载MyQR
pip3 install MyQR
1.3 代码和对应的效果截图
1.3.1 普通二维码
from MyQR import myqr
myqr.run('https://www.shiyanlou.com')
1.3.2 带图片的艺术二维码
黑白的
from MyQR import myqr
myqr.run(
words='https://www.shiyanlou.com',
picture='D:/Automation_Develop_Work/Python_Learning/Other/wm.jpg',
save_dir='D:/Automation_Develop_Work/Python_Learning/Other',
save_name='qrcode_two.jpg',
)
彩色的
from MyQR import myqr
myqr.run(
words='https://www.shiyanlou.com',
picture='D:/Automation_Develop_Work/Python_Learning/Other/wm.jpg',
save_dir='D:/Automation_Develop_Work/Python_Learning/Other',
save_name='qrcode_three.png',
colorized=True,
)
1.3.3 动态二维码
from MyQR import myqr
myqr.run(
words='https://www.shiyanlou.com',
picture='D:/Automation_Develop_Work/Python_Learning/Other/wm2.gif',
save_dir='D:/Automation_Develop_Work/Python_Learning/Other',
save_name='qrcode_four.gif',
colorized=True,
)