- Software to read a QR code?
- 9 Answers 9
- QtQR
- Linux Commando
- Search This Blog
- Thursday, July 2, 2020
- How to generate and read QR code on Linux
- Background
- QR code generation
- QR code scanning
- Scan Barcode QR Code From Webcam & Image File in Linux
- Read Barcode + QR Code From Image File and Camera in Linux
- How to Install Zbar – Barcode, QR Code Reader for Linux Desktop
- How to Scan Barcode / QR Code in Linux Using ZBar
- ZBar Review – Software to Scan Barcode QR Code From Camera
Software to read a QR code?
I saw a QR code reading a book, but I don’t have a smart phone to decode it. So I just took a picture of it and saved the picture to my PC. I downloaded libdecoderqr0, libdecodeqr-dev, and libdecodeqr-examples for reading it. But I don’t know how to use them. What do I do next? Or is there a nicer way to read QR codes?
The simplest way to scan a QR Code is to use one of those online services like e.g. qr4u.online, webqr.com
9 Answers 9
- Command-line QR-code decode: zbarimg Install the zbarimg command line application by running:
sudo apt-get install zbar-tools
Use the program zbarimg provided by the package to read your QR encoded image: From the command line:
dmtxwrite -o image.png input.txt
This will encode text contained in input.txt in current directory to an image, image.png , in the current directory. dmtxread — scan Data Matrix barcodes. Simple example:
The above will encode the information in the input.txt file in an image file called test.png . Or you can input text from the console with:
qrencode -s 10 -o ubuntu.png http://www.ubuntu.com
data matrix seems way better, since it has a proper decoder and it can encode null bytes. this doesn’t work: echo -en «\x00» | qrencode -t PNG -o lol.png
I could not get the libdecodeqr examples to output anything. dmtx seems to be very limited regarding the size of the data; a regular SSH key wouldn’t fit. (Also, libdmtx.org points to something very different nowadays.)
zbarimg —raw qr.png > output.txt to save it to a file. «QR-Code:» text is appended to the output if —raw is not enabled.
xbar-tools also contain a tool zbarcam with which the QR code can directly be scanned using a webcam.
Beware — the zbarimg tool will add a label QR-Code: to the output. To suppress this, use the —raw option.
ZBar recognizes several kinds of bar codes, including QR codes. If I install zbar-tools
$ sudo apt-get install zbar-tools
and save that QtQR image to a file called askubuntu.png , then the zbarimg utility finds and decodes the QR code
$ zbarimg askubuntu.png QR-Code:http://askubuntu.com scanned 1 barcode symbols from 1 images in 0.02 seconds
There is also a zbarcam utility, which you can use to decode QR codes spotted by your web cam.
QtQR
A graphical interface for creating and reading QR codes.
QtQR can read QR codes from image files or from a webcam. It is able to recognise a number of specific types of QR code including web links, email addresses/messages, SMS messages and telephone numbers.
You could potentially scan the QR code from the book using a webcam. If you do this, ensure there is enough light and that you are holding the QR code flat and still. You will see a window with the webcam input on the screen. Wait until green dots appear then close the window and QtQR will tell you what was contained in the QR code.
As of Bionic (18.04), QtQR is available on Ubuntu by running:
You can also install newer versions of QtQR by adding the PPA ppa:qr-tools-developers/qr-tools-stable and installing the package qtqr .
Linux Commando
Initially a Linux command-line interface blog, it has evolved to cover increasingly more GUI app topics. Instead of just giving you information like some man page, I illustrate their usage in real-life scenarios.
Search This Blog
Thursday, July 2, 2020
How to generate and read QR code on Linux
QR code, short for Quick Response code, was initially created to improve on bar codes used in inventory management. Nowadays, QR codes are ubiquitous, on posters, billboards, web pages, etc. This post will illustrate how to generate and read QR codes using the Linux command line interface (CLI).
The programs you will need to generate and read QR codes are qrencode and zbarimg respectively. (If you want to work with a GUI tool, there is QtQR.) To install the 2 programs on Debian:
$ sudo apt install qrencode zbar-tools
Background
A QR code is a matrix of square dots (or ‘modules’ in QRspeak). QR codes have as many as 40 versions of increasing data capacity. Version 1’s dimension is 21 × 21 modules, and each higher version adds 4 modules per side ending with version 40 with 177 × 177 modules.
The exact maximum data capacity of a version depends on several factors, including the type of characters stored, e.g., numeric vs alphanumeric, and the level of error correction desired. At Medium error correcting capability, version 1 can store up to 20 alphanumeric characters; version 40, 3,391.
Fortunately, as we’ll see next, the qrencode utility specifies good defaults, and hides much of the gory details from you.
QR code generation
In its simplest form, qrencode takes the input string to be encoded and outputs the PNG graphic to a file. The following command encodes the URL for this website.
You can specify different parameters to fine-tune the QR code. Use the -l parameter to change the error correction level from the default L for Lowest to M for Medium, Q for Quite High, or H for Highest. In addition, you can explicitly specify the version to use, the size of the module and the margin, etc. The following example generates a version two QR code for the same website at the Highest error correcting level.
Besides the URL, marketers typically encode information such as phone numbers and email addresses.
Many QR code scanners will automatically open the associated app upon scanning a QR code of a special format, e.g., a browser for URLs, email client for email addresses, and phone app for telephone numbers.
QR code scanning
The Linux program zbarimg decodes the QR code stored in a file. To invoke, simply provide the input filename which contains the QR code.
$ zbarimg webURL.png QR-Code:https://linuxcommando.blogspot.com/ scanned 1 barcode symbols from 1 images in 0 seconds
If you specify the -d parameter, zbarimg will display the QR code in addition to the decoded information.
The default camera app of recent Android or iOS phones can also function as QR code scanner. To scan, run the camera app and point it towards the QR code.
Scan Barcode QR Code From Webcam & Image File in Linux
ZBar bar code reader/scanner. Software to Scan Barcode + QR Code From Webcam & Image File in Linux named ZBar. With ZBar you can decode barcode from file, decode barcode from webcam. Inspite of barcode you can also decode QR code from web camera also. This article will inform to you how to install ZBar and review about it.
ZBar is a command-line utility that scans QR codes on an image and allows you to extract their data. You can use this utility to gain insight into how many people are using the QR code or what they are scanning it for.
Read Barcode + QR Code From Image File and Camera in Linux
Because of its great function, ZBar is used by many platform. It is command line based tool, very lighweight. The facilities as follow:
- cross platform – Linux/Unix, Windows, iPhone®, embedded…
- high speed – real time scanning from video streams
- small memory footprint
- small code size – the core scanner and EAN decoder represent under 1K lines of C code
- not limited to images
- no floating point operations
- suitable for embedded applications using inexpensive processors/hardware
- modular components can be used together or separately
How to Install Zbar – Barcode, QR Code Reader for Linux Desktop
ZBar have been added to linux repository so that you can install directly from software center or you can install ZBar from Terminal by executing these:
sudo apt-get install zbar-tools
How to Scan Barcode / QR Code in Linux Using ZBar
We will practice to scan QR code generated from this trial (you can make a trial too or use the QR code image below to scan):
Save QR code above as “test.png” to follow this experiment! ZBar has some command to decode QR code or barcode as follow:
- man zbarimg or man zbarcam , used to show ZBar manual
- zbarimg –help or zbarcam –help , used to show ZBar help
- zbarimg –version atau zbarcam –version , used to show ZBar installed version
Go to directory where to save the “test.png” file, right click on the blank area and choose “Open in Terminal” , then decode it by typing zbarimg test.png — You will see result as follow:
ZBar Review – Software to Scan Barcode QR Code From Camera
If you have a smartphone, you most likely have seen qrcode. They are becoming more and more popular in advertisements, promotional materials and marketing campaigns. However, they are not always easy to understand or interpret. In this article, I will teach you how to read a qrcode on your Linux computer which will save you time in the long run.
QRCodes are an increasingly common way to send information to the recipient. They fall into a category of barcodes called “near-field communication” or NFC, and they’re used in many different ways such as automatic checkouts at retail stores or sending texts. In this tutorial, we’ll show you how to scan a QRCode on Ubuntu Linux.