Python制作二维码

Posted HuaBro

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python制作二维码相关的知识,希望对你有一定的参考价值。

第一种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\',
         )

 

 

 

 

以上是关于Python制作二维码的主要内容,如果未能解决你的问题,请参考以下文章

用5行Python代码制作自定义的二维码

python如何实现条形码和二维码制作?

通过片段之间的导航传递数据android studio

python如何通过列表转换为二维码?

Python制作二维码简易步骤

使用python制作二维码