I remember downloading stuff from usenet 20 years ago and the par files going with them. Basically, files were split into chunks and you’d merge the chunks. In case there was a missing or corrupt chunk, the par files would allow recovering the missing part. You did not need to download entire par chunks either. You lost 1mb? Download 1mb of par and recover it (or something like that, cant remember now).
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.
I remember doing this for years as well and it seemed like magic and this algorithm blew my mind that any piece of a movie could be rebuild from a small part of par files. ChatGPT is quite good at explaining it
The concept of being able to (for a physical example) rip ANY page out of a book and being able to replace it using only the information on your single "magic page" is incredible. With two magic pages you can replace any two torn out pages, and the magic pages are interchangeable.
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 also learnt the dubious skill of reading QR codes by hand. At work 1% of the QR codes that we received were not scannable. However when decoded by hand (thanks you this guide and others) they all contained the string we expected.
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.
Very good. However, I wanted to know the rules regarding how big that border has to be and how some QR codes have a logo in the middle. We all want pretty QR codes!
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?
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.
Check out their submission history, I think dang or a mod reupped it - this is actually the submission from 3 days ago, sometimes the mods give posts a 2nd chance if they think they are or interest.
I remember downloading stuff from usenet 20 years ago and the par files going with them. Basically, files were split into chunks and you’d merge the chunks. In case there was a missing or corrupt chunk, the par files would allow recovering the missing part. You did not need to download entire par chunks either. You lost 1mb? Download 1mb of par and recover it (or something like that, cant remember now).
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.
I remember doing this for years as well and it seemed like magic and this algorithm blew my mind that any piece of a movie could be rebuild from a small part of par files. ChatGPT is quite good at explaining it
The concept of being able to (for a physical example) rip ANY page out of a book and being able to replace it using only the information on your single "magic page" is incredible. With two magic pages you can replace any two torn out pages, and the magic pages are interchangeable.
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.
Discussion (655 points, 2024, 87 comments) https://news.ycombinator.com/item?id=39087752
I also learnt the dubious skill of reading QR codes by hand. At work 1% of the QR codes that we received were not scannable. However when decoded by hand (thanks you this guide and others) they all contained the string we expected.
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.
Very good. However, I wanted to know the rules regarding how big that border has to be and how some QR codes have a logo in the middle. We all want pretty QR codes!
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?
I've written a bit about logos at https://shkspr.mobi/blog/2010/11/hiding-space-invaders-in-qr...
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.
"... pretty QR codes", reminds me of a paper from SIGGRAPH 2025 I saw a few weeks ago.
"Claycode: Stylable and Deformable 2D Scannable Codes"
https://arxiv.org/abs/2505.08666
https://claycode.io/pages/scene_claycode.html
https://www.youtube.com/watch?v=Sx9k2iyXQhY
The logo corrupts the QR code. But QR codes can be generated with different levels of error correction.
So a code with a high error correction factor can repair a QR code with a logo obliterating the middle of the code.
til. i made a little qr code creator thingy that i personally used and I didn't know it didn't work with low error correction with middle logos.
In 2020 I ran into problems with borderless qr codes. Today it seems it is not an issue anymore.
You same day resubmitted this 3 days ago already.
Check out their submission history, I think dang or a mod reupped it - this is actually the submission from 3 days ago, sometimes the mods give posts a 2nd chance if they think they are or interest.
I've had it happen to my submissions in the past.