python [one line of code] generate personalized QR code

QR code display

Because CSDN does not allow the display of QR code pictures, the pictures below will not be displayed. You can skip the QR code display and look at the code


Ordinary black and white QR code

insert image description here

Static QR code

insert image description here

Dynamic QR code

insert image description here


Install

pip install MyQR

parameter

  • words : URL entered after scanning the code
  • picture : The address of the local picture, the picture format can only be [.jpg, .png, .bmp, .gif]
  • colorized : Whether the generated QR code is black and white (False) or color (True), the default is False
  • version : Set the fault tolerance rate, the default is 1. Basically do not need to fill in, the default is fine, the same below
  • level : Control the error correction level, the range is L, M, Q, H, increasing from left to right, the default is H
  • contrast : Used to adjust the contrast of the picture, 1.0 means the original picture. The default is 1.0.
  • brightness : used to adjust the brightness of the picture. The default is 1.0.
  • save_name : save the name, the format can be .jpg, .png, .bmp, .gif.
  • save_dir : save path, the default is the current working directory

the code

The parameters in the code can be modified and tried by yourself. For the specific parameters, refer to the above

myqr.run(words='https://image.baidu.com', picture=r'D:\Data\jt.gif',colorized=True)

Guess you like

Origin blog.csdn.net/weixin_51033461/article/details/125784916