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?
Several options:
Command-line QR-code decode:
zbarimg
Install the zbarimg command line application by running:
Use the program
zbarimg
provided by the package to read your QR encoded image:From the command line:
The above will display what is encoded in the image in the terminal.
Web-based Applications for decoding and encoding
You can encode and decode online at online barcodereader.com and at ZXing Decoder Online.
Data Matrix command-line decode and encode:
libdmtx
libdmtx
is a library for reading and writing Data Matrix 2D barcodes -- two-dimensional symbols that hold a dense pattern of data with built-in error correction.Install libdmtx-utils from the repository and try using the tools it provides:
dmtxwrite
- create Data Matrix barcodes. Simple example: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:This reads the encoded
image.png
and writes the decoded messages to standard output.libdmtx Resources:
Command-line QR-code encoding:
grencode
If you would like to generate QR codes, you can install
qrencode
from the repositories.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:
The above will generate a QR encoded image called
ubuntu.png
with the URLhttp://www.ubuntu.com
encoded in it.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
.ZBar recognizes several kinds of bar codes, including QR codes. If I install
zbar-tools
and save that QtQR image to a file called
askubuntu.png
, then thezbarimg
utility finds and decodes the QR codeThere is also a
zbarcam
utility, which you can use to decode QR codes spotted by your web cam.In 2020, you should use CoBang to scan QR code. It was written recently by me, to catch new technologies in Linux desktop.
How to install in Ubuntu 20.04:
It doesn't support generating QR code yet. It is not high priority because there are already some websites to do, with pretty beautiful pictures.
Google Chrome has an extension in the Chrome Web Store called QRreader.
If a QR code exists on a webpage, just right-click on it and voilà!
I actually wanted to be able to read these QR codes myself, so I made a little app that sits up on the system tray, you click it and it highlights all of the QR codes (or bar codes) visible on the screen and tells you what they say... Also, you can click on it and copy any of the code text to the clipboard to paste into a browser etc. I'm using ZBar, and you can check it out here...
http://cnlohr.blogspot.com/2011/08/desktop-qr-code-reader-for-ubuntu.html
Anyone wanna help me turn it into a package?
There's a Brainstorm request for a QR reader here: http://brainstorm.ubuntu.com/item/15111/ Included in the comments are links to Tbarcode and Decodecamera which you might want to check out. I'd link directly to them, but I can't post more than one link yet.
QTQR is not possible to install onto Ubuntu 10.04 LTS - there are broken packages. Instead of this you can use this link to get it installed.
Qreator is another QR-code creator:
repository - https://launchpad.net/qreator
homepage - http://davidplanella.org/project-showcase/qreator/
Qreator installation
Open a terminal with Ctrl+Alt+T and type these commands:
Use a couple of existing utilities:
The copy QR and bar codes to clipboard with this one liner:
Make a shortcut for it:
If your
.profile
is well set up so that your local bin folder is in PATH (after next login) you can runqrr
and select with your mouse a portion of your screen containing a QR code, the code is in your primary selection. Usexclip -selection clipboard
to copy to clipboard.