Ubuntu - How to generate QR Codes

Quick Response Codes are appearing everywhere. You can see them in museums, near the tourist attractions or all over the web. There is no doubt that QR Codes are useful as they can contain any information within reasonable limits.

The best place to start is to read Wikipedia entry about QR Codes as it contain all needed information about standard.

Installation

To generate your own QR Codes you need to install qrencode utility:

$ sudo apt-get install qrencode

Usage

You can easily encode short text like URL:

$ qrencode -o qr_blog.png "http://blog.sleeplessbeastie.eu"

SMS message:

$ qrencode -o qr_sms.png "smsto:+48111222333:sms message"

File contents (vCard in this example):

$ cat vCard.vcf 
BEGIN:VCARD
N:Galazka;Milosz;;;
URL:http://www.sleeplessbeastie.eu
END:VCARD
$ cat vCard.vcf | qrencode -o qr_vcard.png

Text from standard input:

$ qrencode -o qr_text.png
If you are insecure, guess what? The rest of the world is, too.
Do not overestimate the competition and underestimate yourself.
You are better than you think.

Timothy Ferriss
^D

Tips

By default each dot is 3 pixels in size, you can increase it by using -s parameter:

$ qrencode -o qr_bigger.png -s 12 "This QR Code is big"

You can add a little blur using ImageMagick convert command-line tool:

$ qrencode -o - "http://blog.sleeplessbeastie.eu" | \
  convert - -blur 0x.5 qr_blog_blurred.png

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu