How QR codes work

You have probably seen ways in which the physical world represents digital data in print. The one you are most familiar with is perhaps bar codes. You see them on products at a shopping mall. The checkout counter scans them and fetches the information about the product from a database. Even books have their ISBN codes printed in a bar code.

Over the last decade, another technology named QR or Quick Response code has gained popularity. While traditional bar codes are 1-dimensional and can represent at best between 16 – 20 characters of data, QR falls under a group of data encoding technology called the ‘data-matrix code’ or colloquially, ‘2-dimensional bar codes’. QR codes were pioneered by the Japanese company, Denso wave.

QR codes are capable of holding 7089 characters of data. You can see QR codes all over the Internet, on packaging, on information booklets and even on branding boards at shops. They usually serve as a way to encode URLs so that the user can get further information about a product or an organisation. But URLs are not the only thing possible inside a QR code. Let’s see how they work.

What is QR code?

QR code is a way to represent data in a 2-dimensional matrix in a two-colour image. Data is encoded in a square using units called ‘modules’. Denso Waves’s specification specifies multiple resolutions for QR codes. The smallest resolution is 21 x 21 modules, whereas the largest is 177 x 177 modules. Please be aware that the numbers don’t have anything to do with pixel resolution. The numbers represent modules, with one module being one unit of compressed data within QR codes. Each module can have any pixel resolution depending on where it is printed. On a book, the 21 x 21 module QR code may be a 400 x 400 pixel square, whereas on a billboard, it will be 4096 x 4096 pixel square.

Regardless of the pixel size, a 21 x 21 module QR code can contain 441 modules of information. This  gives 1817 characters of text data. In English language, 1817 characters also means 1817 alphabets, symbols or digits. But that may not be the case with other languages such as Hindi or in Kanji script of Japanese, on which QR codes were originally tested extensively in Japan.

The densest QR code measures 177 x 177 modules and can have 7089 characters, which is the equivalent of three average-sized paragraphs of English content.

How to generate QR codes

You do not need to be a programmer to generate QR code. Several websites offer their service free of cost to generate a QR code from alphanumeric data. A Google search for ‘QR code generator’ will give you three screenfuls of generators for different types of data. Some of these are online services, while others are downloadable apps.

If you are a programmer, there are libraries to help you generate codes from your program. Libraries are available for all modern programming languages such as Javascript, Java, Python, PHP, Ruby and .NET. You do not need to write any code to generate the image from scratch. You should use the libraries to do it for you. All you need to do is pass your data to the libraries and they will return an image to you.

How to scan QR data

There are several apps for Android, iOS and the desktop to use your camera to scan a QR code and decode the information. There are also web-based scanners to integrate a QR-code scanner on a web page. The may scan an image either from your camera or from your storage disk / image gallery.

Different types of QR codes

Here are the different types of QR codes as specified by Denso Wave.

  1. Standard QR code: is Denso Wave’s original QR code, now used widely around the world. as mentioned earlier, the maximum capacity of a standard QR code is 7089 characters using a module resolution of 177 x 177.
  2. Micro QR code: was designed for printing in tiny spaces, such as on the body of a pencil. The code is much smaller to represent than standard codes. The code is usually used for representing product numbers. It can store 35 characters.
  3. iQR: is a new specification and is receiving adoption. An iQR code can be square or rectangular. Data can be packed very densely in an iQR. Hence it requires a highly accurate scanner and good lighting. Due to the density of data, iQR also take more time to generate and scan. An iQR code is capable of storing 40,000 characters.
  4. SQRC: is a secure version of a QR code. It contains public information and a private one. The data only makes sense when both parts are decoded. To be able to decode the private data, the scanning device must have a cryptographic key that is pre-approved by the party that generates the secure QR code.
  5. Frame QR: is a regular QR, but with the capability to embed a human viewable image within the QR. This is useful for saving space, since the creator of the code does not need a seperate caption to tell you what the code will lead to. It can also have branding logos.

Conclusion

As we integrate the digital world more closely with the physical world, we need more ways to represent digital data on physical objects. Bar codes started the trend, but QR codes have given us more options. Denso Waves continues to pour further research into QR and data encoding. Only time will tell what options we will see in the future.

Leave a Reply

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