Quickly generate and decode QR codes in Linux terminals
Overview
We need to do two things:
-
Decode QR code on Linux screen and print the result on terminal
-
Convert a string to QR code on terminal, and display the QR code in the terminal for scanning
Method
-
Generating QR code
qrencode
is a common CLI program for generating QR codes, found in many distribution repositories. It supports outputing QR code in terminal. (It also supports output to image files) -
Decoding QR code
This method is tested on X11
-
Run a CLI screenshot program in terminal to get QR code image
scrot
is a CLI screenshot program that is available in many distribution repositories -
Pass the image to CLI program to decode the QR code.
We use
zbar
to decode QR code and display results in terminal.
-
I've implemented above into a shell script:
-
Run this script in the terminal, and then rect-select the QR code on the screen with mouse to get the results.
-
Pass any string as an argument to this script to display the QR code on the screen terminal.
Script
https://github.com/garywill/qrshot
Buy me a coffee
Your donation will be an impetus for me!