将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

KeywordDescription
pacman_colorColor of the smiley, default: ^{tt6}$
dot_colorColor of the dots which the smiley should eat, default: ^{tt6}$
ghostsNumber 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_colorsA 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)

结果:

Example of to_pacman result

发光

创建具有“发光”效果的二维码。

用法:to_glow

KeywordDescription
filter_idIndicates the id of the filter, default: ^{tt12}$
deviationIndicates 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')

结果:

Example of to_glow result

模糊

创建具有“模糊”效果的二维码。

用法:to_blur

KeywordDescription
filter_idIndicates the id of the filter, default: ^{tt15}$
deviationIndicates 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')

结果:

Example of to_blur result

更改

0.1.1–2016-08-18

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何使用URLhttp://localhost:8080/appcontext/METAINF/index.html?   Google应用程序引擎Java错误   java此GUI在设置BoxLayout后不显示任何内容   setParameter情况下的java临时类型(字符串名称、对象值)   Rijndael 256加密与Java&Bouncy Castle   java如何检查字符串是否为空?   java InvalidDataAccessResourceUsageException:无法提取结果集   AWTGLCanvas正在隐藏java JToggleButton工具提示   使用PDFBox的java格式数字   java Datainputstream和readUTF数据丢失   在java中使用axiomapi解码XJWT断言   为什么Java和PHP的相同代码不起作用?   JavaGoogleSigin错误,代码工作真实设备工作良好,但不工作模拟器获得错误ApiException 12500,谢谢,我也是新的   java通过使用JNA将void**参数作为char[]获取函数的结果   java如何使用泛型树集创建比较器?   未正确解析java简单文本文件   在java中将字符串转换为MyString对象类型   java Spring继承不起作用