A QR Code, Step By Step

We should all be familiar with QR codes, those blocky printed patterns containing encoded text, URLs, or other data. A few years ago they were subject to their own cloud of hype, but now they have settled down in their niche of providing a handy route for a smartphone owner to reach a website without having to type an address.

Have you ever wondered how they work? There are plenty of dry technical guides out there, but if they’re not your thing you might find [Nayuki]’s step-by-step guide to be of interest. It explains the encoding and error checking bit generation process before starting on the familiar three-squares pattern and timing bars of the QR code itself. The really interesting part comes with its explanation of overlays, a set of repeating patterns that are added to the final data segment, and how the pattern used is chosen to minimise penalties due to large blocks of the same colour in the final piece. The chances are most of us will never have to create a QR code from scratch, but it is this type of fascinating technical general knowledge that makes guides like this such an interesting read.

QR codes have appeared in quite a few projects here over the years, but the one we find particularly amusing is this project to hack them by changing one QR into another.

Via Hacker News.

22 thoughts on “A QR Code, Step By Step

  1. I think when scanning QR codes for URLs, it’s important that the user be shown the key features (such as the FQDN – in Roman characters if there’s a chance of unicode/RTL/alternate trickery) front and centre before they go to the link.

    That said, no doubt it’ll go to a URL redirection service, to either legitimately track redirects and shorten the length of the URL and therefore size of the QR code … or to conceal a dubious final destination… What really really shits me is redirectors that require javascript to reveal their destination, that deliberately aim to defeat programmatic decoding by non-browser apps.

  2. Much like that the little toe is an evolutionary adaption to locate the corners of furniture, the QR codes main purpose in life is to indicate the former location of drivers, apps, or other software necessary to the operation of the clearance Chinesium gadget you just bought.

  3. I remember when I was young and programming in hex sequences and address locations instead of any actual sort of language… I found the wiki article on QR codes and went, “It’s basically just standard ASCI? I’ve memorized this!”

    I then proceeded to, from scratch, compute and draw QR codes on whiteboards. It was a fun practice and in time I discovered post-it notes are also excellent places to sketch them :)

    Incidentally if the center of each bit is marked, the actual square isn’t that important, so as ‘unfinished’ as this one looks, it actually is very quickly readable.
    https://i.imgur.com/1qB4FoAh.jpg (Made it a few months ago for a very wonderfully nerdy s.o.)

      1. What web browser software are you using? Is it an old version of Internet Explorer?

        I designed my page with a fair amount of compatibility in mind. I tested it to work in IE 11, Edge 42, Firefox 63, and Chrome 70. Your error message suggests that maybe it refuses the XHTML media type. Aside from that, if your browser is old it might not support SVG properly.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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