Create Your Own QR Codes on Linux

As smart phones are becoming more pervasive, 2D bar codes are starting to appear all over the place. The QR Code format is one of the most commonly used styles of these matrix bar codes. These QR Codes often contain a URL to send a smart phone user to a particular web site, but all kinds of textual information can be embedded in these codes.

To be exact, a QR Code can hold up to 4,296 alphanumeric characters. There are a number of websites available that you can use to create QR Codes, but why do that when you can take care of it on your own computer?

There’s a small program available for Linux called qrencode that you can use to create QR Codes and save them as PNG images. You can download the source tarball from the qrencode developer’s website or you can install it from your distro’s repositories. You can install it in Ubuntu with:

[term]sudo apt-get install qrencode[/term]

qrencode is a simple command line utility. In its simplest form, it can be invoked like this.

[term]qrencode -o hello.png ‘Hello, World! This is my first QR Code.'[/term]

By default, qrencode makes the dots 3 pixels in size. You can change this size with the -s switch. If you’d like to make your image a little bigger, try a pixel size of 5.

[term]qrencode -o hello_big.png -s 5 ‘Hello, World! This is my first QR Code.'[/term]

If you don’t provide a string at the end of the command, qrencode will accept the encode string from standard input. You can easily enter multiple lines of text in this mode. When you’re done, just hit [Enter] and then hit [Ctrl]+[D].

QR Code

Have fun making your QR Codes.

7 thoughts on “Create Your Own QR Codes on Linux

  1. Fadi R

    Thanks for the tutorial. I’ve made a script that automates the process. You can add the script to your menu or make a .desktop file for it (be sure to launch it in terminal):

    imageviewer=eog # <=could use anything: gwenview, gimp, gthumb…
    qrpath=/home/lapinot/Desktop # <=enter the directory you want the encoding to happen
    read -p "Enter QR message: " message
    qrencode -o $qrpath/qr.png "$message"
    #sleep 10
    $imageviewer $qrpath/qr.png
    rm $qrpath/qr.png

    Reply
  2. Onray

    There’s apps on most recent phones that can read and handle several different kinds of qrcodes, for example, you can create a phone contact item with a qrcode, after scanning, the user will be able to add the contact he just scanned. And for those that don’t know, QR = quick response, and it usually is.

    Reply
  3. Rafael

    Thx for the tip. btw any idea where about steps to read QR on a digital camera so to replicate it or print it in the desktop with the above Linux QRENCODE piece of software ?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.