Also, given the choice between optimising for 21 x 21 modules or something a lot larger, what is recommended in this day and age? Is blocky best?
So a code with a high error correction factor can repair a QR code with a logo obliterating the middle of the code.
"Claycode: Stylable and Deformable 2D Scannable Codes"
https://arxiv.org/abs/2505.08666
Basically, at the maximum level of error correction, you can obscure up to 30% of the code (excluding the corner target) and the data is still readable.
However, most QR readers will adjust the colours they see to pure black and white - so light colours will be squashed down to white. That means you can have some pretty colourful designs and still keep the codes readable.
Ideally, the border should be at least 2 blocks wide - but modern scanners are pretty good at picking out the targets.
As for size - that depends on your target audience. If your users are sat down and have the QR in front of them, you can cram in as much data as you like. If the code is on a billboard people are far away from, use as little data as you can and make the code as physically large as possible.
That blew my mind and I went into a rabbit hole of error correction. I did not know about the reed-solomon or any other methods. Just took days to understand it. Implementing my own par like shitty thing in the process.
This brings that back as I’m more curious about the error correction than the actual bit encoding.
The math we have mastered is incredible. If only they could impart this wonder to children instead of rote worksheets enforced by drill sergeant math teachers.
While I'm ranting, I checked out a book from the library yesterday called "Math with Bad Drawings", it's very fun, and approachable for anyone with no math background, kids and adults enjoy it.
We need more STEM for fun, and not just STEM for money. That's how we get good at STEM.
I've had it happen to my submissions in the past.
But there was an error in the error correction pattern. It would flip a bit on the message length. The QR data changed from a string of 4 characters to a string of 933+ characters, and either
- Be unreadable (xzing)
- Return 933+ characters of garbage (cognex)
- crash
- return the previous barcode scanned (iOS)
I really learnt something about Reed Solomon error correction that day. I have the QR code framed somewhere. Sometimes when bored I’ll scan it and confirm that it still brings up whatever I scanned last.
gnabgib•6mo ago