快速、健壮且功能更完整的基于cffi的libqrencode绑定(Py2、Py3和PyPy)
项目描述
快速、健壮且功能更完整的基于cffi的libqrencode Python绑定(http://fukuchi.org/works/qrencode/index.en.html)。
兼容Python 2、Python 3和PyPy!
安装
$ pip install libqrencode-cffi
示例
>>> import libqrencode as qr >>> qrc = qr.QRCode("Hello, world!") # The raw QR code can be accessed, where each item is a bitfield containing # information about that portion of the code (see DATA_* constants). >>> qrc.get_raw_data() [193, 193, 193, 193, ... 3, 2, 2, 3, 3] # If PIL is installed, a PIL image of the QR code can be created: >>> qrc.get_im(border=3) <PIL.Image.Image image mode=L size=81x81 at ...> # And if lxml.etree / xml.etree is available, an SVG can be generated: >>> qrc.get_svg_etree() <Element g at ...> >>> qrc.get_svg_string() '<g><rect fill="white" height="21" width="21" x="0" y="0"/>...<rect fill="black" height="1" width="1" x="20" y="19"/></g>'
常量
编码模式(见https://en.wikipedia.org/wiki/QR_code#Encoding)
MODE_NUL(qrencode内部使用)
MODE_NUM
MODE_AN
MODE_8(默认)
MODE_KANJI
MODE_STRUCTURE(libqrencode不完全支持)
MODE_ECI(libqrencode不完全支持)
MODE_FNC1FIRST(libqrencode不完全支持)
MODE_FNC1SECOND(libqrencode不完全支持)
错误更正模式
ECLEVEL_L(7%;默认)
ECLEVEL_M (15%)
ECLEVEL_Q (25%)
ECLEVEL_H (30%)
原始数据位掩码
DATA_BW(1=黑色/0=白色)
DATA_DATA_AND_ECC(数据和校验码区域)
DATA_FORMAT_INFO(格式信息)
DATA_VERSION_INFO(版本信息)
DATA_TIMING_PATTERN(定时模式)
DATA_ALIGNMENT_PATTERN(对齐模式)
DATA_FINDER_PATTERN(定位图案和分隔符)
DATA_NON_DATA(非数据模块(格式、定时等))
项目详情
关闭
libqrencode-cffi-0.1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 654c214f73b6c5f57e034231e1e8e2ee5c3b3cc83697e4923fc65e7e2319f277 |
|
MD5 | de138a7dd6616756d4f3e1c9b4d29d49 |
|
BLAKE2b-256 | 9fefa81c45dac542bfb435250f3f8a43f0d07bfb49dedd82a707b51b6065d2ba |