QR code tricks volume 3

In the wild, you see lots of QR codes with most of the full sized blocks replaced with little dots. They're still scannable because after a reader locates the finder patterns it only looks at the center of each module.

That means that, as we established last time, if you triple the resolution of an image that holds a code and replace every pixel that isn't part of a finder pattern or at the center of a module with random noise, the whole thing will still be readable.

But now each data pixel is surrounded by a ring of eight noise pixels. It's a shame that all that storage capacity is being wasted on noise. You could fit, oh, I don't know, eight other QR codes in that space!

The above image interleaves nine different QR codes. Shifting the finder patterns directs the reader's attention to a different grid of dots. All nine codes can be scanned.


If you squint, the horizontal walls of a maze form a grid of black and white pixels. The vertical walls form a separate grid, offset by half a unit in the x direction and half a unit in the y direction.

Suppose we have a maze generation algorithm that allows us to declare ahead of time that some potential wall sites should contain walls and some should be empty. It would fill in the wall sites we left undecided in such a way that the whole thing forms a proper maze. Not all maze generation algorithms are amenable to such requests, but randomized Kruskal's algorithm is.

Let's request that the horizontal walls form a QR code and let it fill in the vertical walls itself.

I only have demo-quality code to generate these; outputs need to be polished by hand.

Exercise for the reader: It ought to be possible to store two codes in one maze, one in the horizontal walls and one in the vertical walls. You'd direct the reader to scan one or the other by shifting the finder patterns. You'd have a preference for the presence or absence of a wall at every possible wall site, and if you want to make a proper maze you won't be able to fulfill all those preferences, but QR codes carry error correction data, so as long as most of the wall sites match what we want them to be it should be fine. (I have yet to get this to work.)


This last one needs no explanation.


Published 2025-06-10

Previous: Bit plane extractor