Saturday, January 25, 2014
12:56 AM

QR code: Encode and Decode QR code on linux command line

QR(Quick response) code as defined by google is

A machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone.

Here is how we can create QR code in linux using command line.

Using command line:

To create QR code using command line we will need to install the package libqrencode3



After successful install of the package we can encode any string of characters, text,url,numbers, into a QR code as shown below.



Let us say we want to encode the string "Hello" into a QR code.



This will creat a hello.png file in the QR format as shown below.

To be able to decode a QR code on the command line we can use the package zbar.



Once the package is installed we can use the command zbarimg to read a QR encoded file



To decode the hello.png QR we created above



Thus we can see that the QR-Code has been correctly recognized as "Hello "

Useful links: http://en.wikipedia.org/wiki/QR_code http://zbar.sourceforge.net/

1 comments:

Yan Ying said...

Hi,

would like to know is there any way to use zbarimg to scan multiple qr codes in one folder?

Post a Comment