将Segno(micro)二维码转换为更高级的SVG文档
segno-quark的Python项目详细描述
Segno Quark:用于创建更高级(或更少使用)二维码SVG文档的插件
这个(实验性的)Segno插件更改了 不同的方法(即应用SVG过滤器)。
在Pypy、Python2.7和Python3.4下测试。不像塞格诺自己,这个 包不适用于Python2.6。
安装
使用pip从pypi安装此夸克:
$ pip install segno-quark
使用量
安装后,Quark将自动检测为Segno插件和 因此可通过qrcode.to_XXX(...)获得。
可用转换器
所有转换器使用与Segno的SVG序列化器相同的关键字参数, 有关详细信息,请参见segno.QRCode.save()。
etree
创建SVG二维码并将SVG文档返回为xml.etree.ElementTree。
用法:to_etree
此转换器不提供其他关键字参数。
帕克曼
创建带笑脸(和可选重影)的二维码。
用法:to_pacman
Keyword | Description |
---|---|
pacman_color | Color of the smiley, default: ^{tt6}$ |
dot_color | Color of the dots which the smiley should eat, default: ^{tt6}$ |
ghosts | Number of ghosts, default: ^{tt8}$. If set to ^{tt9}$, no ghost appears. Note: Setting this to a very high value may cause an infinite loop iff number of ghosts > number of available dark modules. Additionally, the QR Code may not be readable by common QR Code decoders. The positions of the ghosts are choosen at random. |
ghost_colors | A tuple of colors which the ghosts may get. Default: ^{tt10}$ Not all colors may be used, the colors for the ghosts are choosen at random. |
示例:
>>>importsegno>>>qr=segno.make_qr('Ob-La-Di, Ob-La-Da')>>>qr.to_pacman('obladioblada.svg',scale=10,ghosts=7)
结果:
发光
创建具有“发光”效果的二维码。
用法:to_glow
Keyword | Description |
---|---|
filter_id | Indicates the id of the filter, default: ^{tt12}$ |
deviation | Indicates the standard deviation for the blur operation, default: ^{tt13}$ |
示例:
>>>importsegno>>>qr=segno.make_qr('Ob-La-Di, Ob-La-Da')>>>qr.to_glow('obladioblada.svg',scale=10,color='darkblue')
结果:
模糊
创建具有“模糊”效果的二维码。
用法:to_blur
Keyword | Description |
---|---|
filter_id | Indicates the id of the filter, default: ^{tt15}$ |
deviation | Indicates the standard deviation for the blur operation, default: ^{tt16}$ |
示例:
>>>importsegno>>>qr=segno.make_qr('Ob-La-Di, Ob-La-Da')>>>qr.to_blur('obladioblada.svg',scale=10,color='darkred')
结果:
更改
0.1.1–2016-08-18
- 初始版本