GithubHelp home page GithubHelp logo

qr2text's Introduction

qr2text

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

qr2text's People

Contributors

mgedmin avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.