将PyQRCode生成的SVG转换为ASCII艺术
项目描述
将PyQRCode生成的包含条形码的SVG图像转换为ASCII艺术,用于在终端中显示。
因为我是一个奇怪的人,在终端中使用Mutt通过SSH阅读邮件,有时人们会给我发送用于设置TOTP身份验证的二维码。
示例
$ python3 >>> import pyqrcode >>> qr = pyqrcode.create('Hello world!') >>> qr.svg('hello.svg') $ qr2text --white-background hello.svg █▀▀▀▀▀█ ▀▄█▄▀▄▀▀▄ █▀▀▀▀▀█ █ ███ █ ▀ █▄ █ █ ███ █ █ ▀▀▀ █ ▀▀▄▄▀ ▀ ▄ █ ▀▀▀ █ ▀▀▀▀▀▀▀ █▄█▄▀▄▀▄▀ ▀▀▀▀▀▀▀ ▄▄▄▄▀▀ ▄▀▄▀██▀▀▀ ▀▄█▄▀ ▀ ▀▀▀▀▀▄▀▀▄▀▄▀▄ ▀▀█▀▄ ▀█ ██ ▄█▀▄▀ ▀▀▄ ▄██▄▀ ▀▄ █▄ ▀ █ ▄ ▀▀▀█▄ ██▀█▀██▀█▄▀█ ▀ ▀ ▀▀▀▄█▄▀▄█▀▀█▀▀▀███ ▄ █▀▀▀▀▀█ ▄ █▀▄▀██ ▀ █ █ █ ███ █ █▀▄ ▄ ▀▀█▀▀▀█▀▄ █ ▀▀▀ █ ▄▀▀▀▀ ▀ ▄█▄█ █ ▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀ ▀ ▀ ▀ Hello world!
注意:你可能需要告诉qr2text你的终端是黑白(–white-background)还是黑白(–black-background)。一些二维码扫描器不在乎,但其他一些将拒绝识别反转的二维码。
注意:要使二维码解码工作,你需要在你的系统上安装libzbar(例如,在Ubuntu上使用sudo apt install libzbar0)。
概要
usage: qr2text [-h] [--version] [--black-background] [--white-background] [--big] [--trim] [--pad PAD] [--decode] [--no-decode] [--encode-text ENCODE_TEXT] [filename ...] Convert PyQRCode SVG images to ASCII art positional arguments: filename SVG file with the QR code (use - for stdin) options: -h, --help show this help message and exit --version show program's version number and exit --black-background terminal is white on black (default) --white-background, --invert terminal is black on white --big use full unicode blocks instead of half blocks --trim remove empty border --pad PAD pad with empty border --decode decode the QR codes (default if libzbar is available) --no-decode don't decode the QR codes --encode-text ENCODE_TEXT generate a QR code with given text
项目详情
下载文件
下载适用于您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。
源代码发行版
qr2text-1.1.0.tar.gz (14.3 kB 查看哈希值)
构建分发
qr2text-1.1.0-py3-none-any.whl (7.2 kB 查看哈希)
关闭
qr2text-1.1.0.tar.gz 的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f0ed6843a464c7bdeb1e6e4eeb37bd69708248e8a7f3eb5414f5ea8a120b47cd |
|
MD5 | 88eedd0b18a1c7b563862bbcc7c61182 |
|
BLAKE2b-256 | 2c85e34a4ad80df38f72bcea7dd8e4ed26c9379e7d4c2789f89db8661b3bfcdb |
关闭
qr2text-1.1.0-py3-none-any.whl 的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 0aebe6a8bc698692329861512ea29784a92b65cf3dfa5337b7230477fa56e0bd |
|
MD5 | 93474fc067f36c850c1fdb84be97bcd0 |
|
BLAKE2b-256 | c6e1e5e3f5ab288d1e01b737696a515c50c68ac5bfb614a2e14bec2f3e715337 |