Gordon Myers

Articles on Life, Truth, Love, Computers, and Music

Fun with QR codes

Lately I've been a little bit addicted to QR codes, ever since installing a Barcode Scanner app for my phone. They are so cool! But they're also becoming a bit ubiquitous, as you see them on all sorts of fliers and posters and even postcards now, and so we're starting to tune them out mentally as the novelty fades. As a result, marketing people are looking for ways to make them more eye-catching, and one such way is by arbitrarily inserting other graphics into them that look nothing like QR codes.

Someone discovered/realized that it is possible to actually remove whole portions of the QR code and replace them with pretty much whatever you want, just because a lot of the data that is encoded in QR codes is not actually the data itself, but large amounts of "error correcting." The original designers of QR codes were smart enough to make them in such a way that even if you were missing part of it, it could still work. So marketing people, and now myself as well, have already begun to abuse that fact by ripping out the middle of QR codes and putting other stuff there instead. For example, here's a functioning code that will take you to my website, and also happens to include my initials.

In this case, the graphics I inserted actually do resemble part of the QR code itself. And I like that. I think it's more subtle and gets people to raise an eyebrow. So last night I built a little utility to generate these and have included it below for mass consumption. Basically all I am doing is using a library called PHP QR Code to generate the initial image, then arbitrarily removing the center and drawing text on top of it. It was a bit tedious to develop, as the default PHP text function actually drew things larger than I was hoping for. So I wrote a function that draws the letters myself, pixel by pixel. (Not difficult at all, just tedious.)

I think seeing text in the middle of the code is cool enough that people might look at it and say, "wait... does that really work?" and then scan it out of curiosity. I realize, too, that by sharing this information with the world, I am only speeding up the rate at which the novelty of that wears off too, but it's going to wear off sooner or later anyway, and for now it is still kind of fun. So feel free to start generating your own QR codes using the little utility I hacked together last night!


A few words of caution: I am literally just removing the center and replacing it with whatever text you enter. There is no fancy calculation involved, it's just quick-and-dirty replacing the middle and hoping for the best -- which means that if you enter too much text, it might not work. It's better to minimize the amount of data removed, because the more you remove the less likely it is to work. And I've found that using longer URLs is actually better than using shorter URLs, because the longer ones require more space to generate so you end up with a smaller text footprint. And also keep in mind that each generation is unique, so if you leave the "direct download" box UN-checked and then just keep hitting refresh, you'll see the little dots change each time. Sometimes one combination won't work, while another one will for the exact same input. So just make sure to test it.

Post a Comment

(Will not be published)