 are saving the QR code in PNG format, the -s parameter specifies the height of a black QR code pixel. By default, Qrencode draws every black dot three by three pixels. The program creates a slightly smaller QR code with quite a wide margin with the following command:
$ qrencode -s 2 -m 10 -o qrcode.png 'Hello World!'
A white border appears around the QR code that is exactly 20 screen pixels wide (10 QR code dots in width, with each dot two pixels). If you are creating EPS images, the only parameter available is -m; -s moves the entire QR code out of the image in this case. To control the resolution of PNGs further, use the -d parameter to define the dpi.
Besides the specified data, the QR code contains additional error correction information. If a portion of the image is damaged, it allows you to reconstruct the missing or illegible data. The more additional information the QR code contains, the more heavily damaged it can be without becoming useless.
Increasing the error tolerance increases the size of the image because you need more black dots (Figure 3).
The QR code standard thus uses four levels of error correction: H level allows you to read all data if 30 percent of the QR code is destroyed, Q level if 25 percent is unreadable, and M level if just 15 percent is unintelligible. At the lowest level, L, only 7 percent of the data can be faulty. In Qrencode, the -l parameter selects the error correction level. The possible values are pretty much what you would expect: L, M, Q, and H.
The level you choose depends on the proposed use. If you expect the QR code to be exposed to external influences (e.g., wind, weather, graffiti) or if you are planning to manipulate the image deliberately (see the “Intruders” box), you will want the highest level, H. On a business card, the lowest level, L, is sufficient. If in doubt, simply omit the -l parameter. The program then uses level L by default.
Qrencode lets you encode any text, including URLs. You only need to use single quotes if blanks and non-standard characters appear in the text:
$ qrencode -o lpm.png http://www.linuxpromagazine.com
All modern QR code readers recognize that this is a web address and will offer to open it in the browser.
Getting an QR-encoded address automatically to enter a smartphone owner’s address book is more difficult. In this case, you need to enter your address and some additional, cryptic information:
$ qrencode -o address.png 'BEGIN:VCARD VERSION:4.0 FN: N:Schuermann;Tim;;; ADR:;;Putzbrunner Str. 71;Munich;;81739; END:VCARD'
Typing this is not exactly easy, so to make life easier, you might prefer a QR code generator with a graphical user interface, such as QtQR.
As the name suggests, QtQR is based on Qt. The tool relies on Python and the python-qrtools library. You can simply install the program via the package manager on Ubuntu. For other distributions, you will find the source code and RPM and DEB packages on the project’s download page.
The main window in QtQR is quite simple: Top left in the selection you can set what data you want to store in the QR code. For an address, choose Contact Information (PhoneBook). Depending on the type of information, QtQR displays appropriate fields (Figure 4).
As you fill out the fields, the program creates the corresponding QR code on the right. You can resize the code at top right. Pixel Size lets you set the number of pixels per square dot the QR code uses, whereas Margin Size lets you specify the size of the margin. Error Correction lets you define the correction level. Once you have set all parameters, save the code as a PNG file by clicking the Save QRCode button.
Portable QR-Code Generator
If QtQR’s capabilities do not meet your needs, you can try Portable QR-Code Generator. It also encodes geographical coordinates and WiFi access data, which can be useful if you want to offer guests quick access to WiFi as a hotel or coffee shop operator, for example.
Because Portable QR-Code Generator is written in Java, you must first install a Java run-time environment via the package manager. On Ubuntu, launch the