Read QR Code from an image.
Install ZBAR utility for scanning and decoding bar codes from various sources.
$ sudo apt install zbar-tools
Inspect available options.
$ zbarimg --help
usage: zbarimg [options] <image>... scan and decode bar codes from one or more image files options: -h, --help display this help text --version display version information and exit -q, --quiet minimal output, only print decoded symbol data -v, --verbose increase debug output level --verbose=N set specific debug output level -d, --display enable display of following images to the screen -D, --nodisplay disable display of following images (default) --xml, --noxml enable/disable XML output format --raw output decoded symbol data without converting charsets -1, --oneshot exit after scanning one bar code -S<CONFIG>[=<VALUE>], --set <CONFIG>[=<VALUE>] set decoder/scanner <CONFIG> to <VALUE> (or 1) --nodbus disable dbus message
Decode QR Code.

$ zbarimg QRCode-wifi-HomeNetwork.png
QR-Code:WIFI:T:WPA;S:HomeNetwork;P:HomePassword;; scanned 1 barcode symbols from 1 images in 0,02 seconds
Decode QR Code from an image with inverted colors.

$ zbarimg QRCode-wifi-HomeNetwork-dark.png
scanned 0 barcode symbols from 1 images in 0,01 seconds WARNING: barcode data was not detected in some image(s) Things to check: - is the barcode type supported? Currently supported symbologies are: . EAN/UPC (EAN-13, EAN-8, EAN-2, EAN-5, UPC-A, UPC-E, ISBN-10, ISBN-13) . DataBar, DataBar Expanded . Code 128 . Code 93 . Code 39 . Codabar . Interleaved 2 of 5 . QR code . SQ code - is the barcode large enough in the image? - is the barcode mostly in focus? - is there sufficient contrast/illumination? - If the symbol is split in several barcodes, are they combined in one image? - Did you enable the barcode type? some EAN/UPC codes are disabled by default. To enable all, use: $ zbarimg -S*.enable <files> Please also notice that some variants take precedence over others. Due to that, if you want, for example, ISBN-10, you should do: $ zbarimg -Sisbn10.enable <files>
It does not work, but you can use convert
utility from the ImageMagick package to overcome this issue.
$ zbarimg <(convert QRCode-wifi-HomeNetwork-dark.png -negate -)
QR-Code:WIFI:T:WPA;S:HomeNetwork;P:HomePassword;; scanned 1 barcode symbols from 1 images in 0,01 seconds
Nice.