qrencode

From RaySoft

libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness.[1]

qrencode is a utility software using libqrencode to encode string data in a QR Code and save as a PNG or EPS image.[1]

Documentation

Syntax

qrencode [PARAMETER ...] [STRING]

Parameters

-d NUMBER, --dpi=NUMBER
Specify the DPI of the generated PNG. (default=72)
-o FILENAME, --output=FILENAME
Write PNG image to FILENAME. If - is specified, the result will be output to standard output.
-s NUMBER, --size=NUMBER
Specify the size of dot (pixel). (default=3)

Examples

Generate and print a QR code for my Wi-Fi based on a SSID and a password from Bitwarden
ssid="$(bw get --raw 'username' 'Wi-Fi Shared Password')"
passwd="$(bw get --raw 'password' 'Wi-Fi Shared Password')"

qrencode --dpi=300 --output=- --size=100 \
  "WIFI:S:${ssid};T:WPA2;P:${passwd};;" \
| lpr -P 'Brother_HL_525DN_series' -o 'media=a4' -o 'number-up=4'

unset -v ssid passwd

References

  1. 1.0 1.1 man 1 'qrencode'