s an image file (Decode from File), or reads it via a webcam (Decode from Webcam).
However, QtQR is quite picky: For example, it does not interpret QR codes for dots of exactly one pixel. Additionally, the program stubbornly insists that the text contains ISO-8859-1 character encoding. If you have a QR code image file, one option is to use the Libdecodeqr-simpletest program, which is actually only intended as an example program for programmers on how to read codes in their own programs with the Libdecodeqr library. However, it is excellent for reading codes at the command line.
On Ubuntu, you can install the reader from the libdecodeqr-examples package with:
sudo apt-get install libdecodeqr-examples
Owners of other distros first need to install a C++ compiler, make, and developer files from OpenCV (on openSUSE, in the opencv-devel package). Then, use the archive of the current version from the Latest Stable Source Code section. Extract it on your hard drive, and in the resulting src subdirectory, enter the following three commands: ./configure, make and sudo make install.
As soon as the program exists on your hard drive, you can decipher QR code in the qrcode.png file with the following command:
$ libdecodeqr-simpletest qrcode.png
… at least in theory; the practical results will be disappointing in many cases. In my tests, libdecodeqr-simpletest simply refused to see any data in the QR codes (Figure 8).
Touch the Bar!
A much better alternative is ZBar. This program reads QR codes from files or via a connected webcam. Ubuntu includes the small tool in the zbar-tools package. On other distributions, you first need to run the package manager to install the developer packages for Qt4, PyGTK and ImageMagick. On openSUSE 12.3, they are named libqt4-devel, python-gtk-devel, and ImageMagick-devel.
If you want to read the QR code with the webcam, you additionally need the kernel header files; on openSUSE 12.3, they are located in the kernel-devel package. If you want to do without this function, you must use the --disable-video configuration parameter to disable it explicitly. After unpacking the source code, you can install the software with ./configure && make && sudo make install. To decode a PNG file with a QR code in ZBar, use:
zbarimg -d <file>.png
The -d parameter ensures that a window with the QR code appears (Figure 9) in addition to the decoded information in the terminal window.
If you want to read a QR code with a camera, you need to launch zbarcam. This pops up a preview window with the image from the webcam. Now hold up the QR code to the camera. Once the program has detected the code, it draws a green border around the QR code and prints the data in the terminal window (see the Big and Colorful” box).
You can disable the preview with the --nodisplay switch; raw delivers the raw data, and xml packages the data in an XML format. The above three parameters help if you want to integrate the tool into a script. The parameters --raw and --xml can also be used with zbarimg.
Of the tested programs, Portable QR-Code Generator offers the greatest functionality. Data entry is also convenient in a variety of tabs. Qrencode creates QR codes more quickly, and it is easy to scripted so you generate QR codes in batches. KBarcode4-light is deprecated, but it is the only program that can generate PDF files; the EPS images created by Qrencode offer similar output.
QtQR is especially recommended for decoding QR codes in PNG format. ZBar is a candidate for the command line that is also excellently suited for use in shell scripts. Along with a webcam, you could use it to create a small terminal for reading QR codes. libdecodeqr-simpletest is hardly usable in production and basically not worth installing.
Tim Schürmann is a freelance computer scientist and author. Besides books, Tim has published various articles in magazines and on websites.
New release comes with better semantic search and improvements to Kontact.
Annual code quality report shows FOSS is more secure at all project size levels.
The Raspberry Pi Foundation has announced 