Customize your beautiful QR code with python?

Don't talk nonsense, directly upload the picture:
Insert picture description here
Insert picture description here

first step:

Press and hold the shortcut key window+R-<Enter cmd-<Enter pip install myqr
Insert picture description here
and enter pip install myqr again, we can find that the yellow circle in the figure myqr is downloaded in python3.8 (the most important thing is to avoid multiple downloads in your computer Python version, so that when you use it is not the version you downloaded myqr).
Insert picture description here

The second step:

Here we choose the version in the yellow circle in the figure, because we know from the above that the version we downloaded is python3.8 (the reason I have so many python versions is that the version of the installation package is different, and sometimes the python version is different. The installation was unsuccessful).
Insert picture description here

third step:

Python code: (The code is very short, but this is in line with python)

from MyQR import myqr
myqr.run(words='https://blog.csdn.net/qq_45137584?spm=1001.2101.3001.5113',version=5,level='H',
picture='F:\\img4.gif',colorized=True,contrast=1.0,
brightness=1.0,save_name='F:\\1\\img4.gif',
save_dir='F:\\1\\')

Attribute:
words is your link
version, you can modify the side length of the
picture. picture is the picture address ( use png and gif pictures as much as possible, I will report errors when I use jpg pictures )
level controls the error correction level, the range is L, M, Q, H, increasing from left to right, the default is H
colorized=True, when True, the original picture color is displayed, and when it is Flase, it is black and white.
contrast=1.0, used to adjust the contrast of the picture

the fourth step:

Take a look at my configuration:
I put my picture directly on the F drive because I am afraid of trouble.
Insert picture description here
The directory of the generated folder
Insert picture description here

Finally, upload the pictures I used, although there are many on the Internet:
Insert picture description here
Insert picture description here
Finally, feel like customizing your special QR code.

Guess you like

Origin blog.csdn.net/qq_45137584/article/details/109504550