Convert PyQRCode generated SVG to ASCII art
Project description
Convert SVG images containing barcodes generated by PyQRCode to ASCII art, for displaying in a terminal.
Because I’m a weird person who reads mail using Mutt over SSH in a terminal, and sometimes people send me QR codes for setting up TOTP authentication.
Example:
$ python3 >>> import pyqrcode >>> qr = pyqrcode.create('Hello world!') >>> qr.svg('hello.svg') $ qr2text --white-background hello.svg █▀▀▀▀▀█ ▀▄█▄▀▄▀▀▄ █▀▀▀▀▀█ █ ███ █ ▀ █▄ █ █ ███ █ █ ▀▀▀ █ ▀▀▄▄▀ ▀ ▄ █ ▀▀▀ █ ▀▀▀▀▀▀▀ █▄█▄▀▄▀▄▀ ▀▀▀▀▀▀▀ ▄▄▄▄▀▀ ▄▀▄▀██▀▀▀ ▀▄█▄▀ ▀ ▀▀▀▀▀▄▀▀▄▀▄▀▄ ▀▀█▀▄ ▀█ ██ ▄█▀▄▀ ▀▀▄ ▄██▄▀ ▀▄ █▄ ▀ █ ▄ ▀▀▀█▄ ██▀█▀██▀█▄▀█ ▀ ▀ ▀▀▀▄█▄▀▄█▀▀█▀▀▀███ ▄ █▀▀▀▀▀█ ▄ █▀▄▀██ ▀ █ █ █ ███ █ █▀▄ ▄ ▀▀█▀▀▀█▀▄ █ ▀▀▀ █ ▄▀▀▀▀ ▀ ▄█▄█ █ ▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀ ▀ ▀ ▀ Hello world!
Note: you may have to tell qr2text whether your terminal is black-on-white (–white-background) or white-on-black (–black-background). Some QR code scanners don’t care, but others will refuse to recognize inverted QR codes.
Note: for QR code decoding to work you need to have libzbar installed on your system (e.g. sudo apt install libzbar0 on Ubuntu).
Synopsis:
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file qr2text-1.1.1.tar.gz
.
File metadata
- Download URL: qr2text-1.1.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e1de72fa6d774f84e8007765527b255d458dcc813050469ffc9a1aa0dacc86b |
|
MD5 | c89425afc14a8388e18b91082843a47f |
|
BLAKE2b-256 | 8d5971a6d1877b2618c37a5f7a57af57af602925376807d4eb5eb4f8acbadb42 |
File details
Details for the file qr2text-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: qr2text-1.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271903d356f060012566923bbfc4bfe46c879505661025efd14adcf9fcff1d94 |
|
MD5 | e67d6e9b2f5862eb94402c725dcb2c58 |
|
BLAKE2b-256 | dfa687a17b024825f37d045868426b794e8a67a886794efff9173f1f669f9902 |