File: README.md
Amazing-QR
Overview
Python QR Code Generator
Generate common qr-code, artistic qr-code (black & white or colorized), animated qr-code (black & white or colorized).
Contents
Examples
Install
# via pip
pip install amzqrUsage
Terminal Way
(TIPS: If you haven't install amzqr, you should python(3) amzqr.py instead of amzqr blow.)
# summary
amzqr Words
[-v {1,2,3,...,40}]
[-l {L,M,Q,H}]
[-n output-filename]
[-d output-directory]
[-p picture_file]
[-c]
[-con contrast]
[-bri brightness]- see Common QR-Code for
Words,-v,-l,-n,-d - see Artistic QR-Code for
-p,-c,-con,-bri - see Animated GIF QR-Code about GIF
Common QR-Code
#1 Words
amzqr https://github.com- Just input a URL or a sentence, then get your QR-Code named 'qrcode.png' in the current directory.
#2 -v, -l
amzqr https://github.com -v 10 -l QThe default size of QR-Code depends both on the numbers of words you input and the level, while the default level (Error Correction Level) is H (the highest).
Customize: If you want to control the size and the error-correction-level, use the
-vand-larguments.-vrepresenting the length is from a minimum of 1 to a maximum of 40.-lrepresenting the error correction level is one of L, M, Q and H, where L is the lowest level and H is the highest.
#3 -n, -d
amzqr https://github.com -n github_qr.jpg -d .../paths/The default output-filename is 'qrcode.png', while the default output-directory is current directory.
Customize: You can name the output-file and decide the output-directory. Notice that if the name is as same as a existing file, the old one will be deleted.
-nrepresenting the output-filename could be in the format one of.jpg,.png,.bmp,.gif.-dmeans directory.
Artistic QR-Code
#1 -p
amzqr https://github.com -p github.jpg- The
-pis to combine the QR-Code with the following picture which is in the same directory as the program. The resulting picture is black and white by default.
#2 -c
amzqr https://github.com -p github.jpg -c- The
-cis to make the resulting picture colorized.
#3 -con, -bri
amzqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6The
-conflag changes the contrast of the picture - a low number corresponds to low contrast and a high number to high contrast. Default: 1.0.The
-briflag changes the brightness and the parameter values work the same as those for-con. Default: 1.0.
Animated GIF QR-Code
The only difference from Artistic QR-Code mentioned above is that you should input an image file in the .gif format. The you can get your black-and-white or colorful qr-code. Remember that when you use -n to customize the output-filename, then the output-filename must end by .gif.
Import Way
from amzqr import amzqr
version, level, qr_name = amzqr.run(
words,
version=1,
level="H",
picture=None,
colorized=False,
contrast=1.0,
brightness=1.0,
save_name=None,
save_dir=os.getcwd(),
)details about each parameter are as mentioned above
# help(amzqr)
Positional parameter
words: str
Optional parameters
version: int, from 1 to 40
level: str, just one of ('L','M','Q','H')
picture: str, a filename of a image
colorized: bool
contrast: float
brightness: float
save_name: str, the output filename like 'example.png'
save_dir: str, the output directoryTips
Use a nearly square picture instead of a rectangle one.
If the size of the picture is large, you should also choose a rightly large
-vinstead of using the default one.If part of the picture is transparent, the qr code will look like:
You can change the transparent layer to white, and then it will look like:
Supported Characters
Numbers:
0~9Letters:
a~z, A~ZCommon punctuations:
console· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
Environment
- Python 3
License
- GPLv3
Buy me a coffee
Since the GitHub Sponsors is unavailable in China yet...
🎉🎉🎉 Thanks for your support. 🎉🎉🎉
File: README-cn.md
Amazing-QR
概述
Python 二维码生成器
可生成普通二维码、带图片的艺术二维码(黑白与彩色)、动态二维码(黑白与彩色)。
Contents 目录
示例
安装
pip install amzqr使用方法
命令行方式
(提示:如果你尚未安装 amzqr ,以下内容请使用python(3) amzqr.py 而非amzqr 。)
# 概括
amzqr Words
[-v {1,2,3,...,40}]
[-l {L,M,Q,H}]
[-n output-filename]
[-d output-directory]
[-p picture_file]
[-c]
[-con contrast]
[-bri brightness]普通二维码
#1 Words
amzqr https://github.com- 在命令后输入链接或者句子作为参数,然后在程序的当前目录中产生相应的二维码图片文件,默认命名为” qrcode.png“。
#2 -v, -l
amzqr https://github.com -v 10 -l Q默认边长是取决于你输入的信息的长度和使用的纠错等级;
而默认纠错等级是最高级的H。
自定义:如果想要控制边长和纠错水平就使用
-v和-l参数。-v控制边长,范围是1至40,数字越大边长越大;-l控制纠错水平,范围是L、M、Q、H,从左到右依次升高。
#3 -n, -d
amzqr https://github.com -n github_qr.jpg -d .../paths/默认输出文件名是“ qrcode.png ",而默认存储位置是当前目录。
自定义:可以自己定义输出名称和位置。注意同名文件会覆盖旧的。
-n控制文件名,格式可以是.jpg,.png,.bmp,.gif;-d控制位置。艺术二维码
#1 -p
amzqr https://github.com -p github.jpg- 参数
-p用来将QR二维码图像与一张同目录下的图片相结合,产生一张黑白图片。
#2 -c
amzqr https://github.com -p github.jpg -c- 加上参数
-c可以使产生的图片由黑白变为彩色的。
#3 -con, -bri
amzqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6参数
-con用以调节图片的对比度,1.0 表示原始图片,更小的值表示更低对比度,更大反之。默认为1.0。参数
-bri用来调节图片的亮度,其余用法和取值与-con相同。
动态GIF二维码
动态二维码与上述的带图片的二维码的生成方法没什么区别,你只要采用 .gif 格式的图片即可生成黑白或者彩色的动态二维码。但注意如果使用了 -n 参数自定义输出的文件名,切记其格式也必须是 .gif 格式。
作为导入文件
# 安装模块后
from amzqr import amzqr
version, level, qr_name = amzqr.run(
words,
version=1,
level="H",
picture=None,
colorized=False,
contrast=1.0,
brightness=1.0,
save_name=None,
save_dir=os.getcwd(),
)以下各个参数已经在上文有所介绍
# help(amzqr)
Positional parameter
words: str
Optional parameters
version: int, from 1 to 40
level: str, just one of ('L','M','Q','H')
picutre: str, a filename of a image
colorized: bool
contrast: float
brightness: float
save_name: str, the output filename like 'example.png'
save_dir: str, the output directory使用提示
请采用正方形或近似正方形的图片
建议在图片尺寸大的时候使用
-v的值也应该适当变大。如果图片有透明无色部分,最终效果是:
你可以将透明部分修改成白色,最终效果会变成
可用字符
数字 0 到 9
大小写的英文字母
常用英文标点符号和空格
console· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
环境
- Python 3
协议
- GPLv3
打赏杯咖啡
GitHub Sponsors 还用不了...
🎉🎉🎉 感谢你的支持 🎉🎉🎉