←back to thread

109 points Xiione | 2 comments | | HN request time: 0.508s | source

Hi HN! This is a hobby project of mine that recently landed me my first interview and helped me get my first internship offers.

Draw on a QR code, and the health bars will accurately display how close the QR code is to being unscannable. How few errors does it take to break a QR code? How many errors can a QR code handle? Counters at the bottom track your record minimum and maximum damage. (Can you figure out how to break a QR code with 0.0% damage to the actual data region?)

Also, click on the magnifying glass button to toggle between "draw mode" and "inspect mode". I encourage you to use your phone's camera to scan the code as you draw and undo/redo to verify that the code really does break when the app says it does.

I wrote the underlying decoder in C++, and it's compiled to WebAssembly for the website.

I hope you find it interesting.

1. solardev ◴[] No.43849216[source]
This is really cool! Thanks for sharing!

Is there a way to get it to compute and visualize the MAXIMUM possible error rate for any given QR code? Like what is the greatest number and arrangement of pixels that could be altered before the QR code is no longer readable?

(Bonus: Is this a setting that can be controlled during QR code generation, based on version number or error correction level, etc.? Can you make some sort of huge and very complex QR code with a lot more redundancy than a smaller one?)

replies(1): >>43849782 #
2. Xiione ◴[] No.43849782[source]
Thanks for checking it out! Essentially, for any given QR code the maximum error rate is reached when you deplete every block's health bar to 1 remaining slice, making sure to invert every pixel in each codeword you've touched (the individual tetris-piece shaped chunks), and then introduce one more single pixel error in any block. This is actually independent of the arrangement of corrupted codewords within each block.

The amount of redundancy is determined solely by the specific version-ecLevel pair a code has. So, the code with the largest amount of redundancy (in bytes) is one that has version 40 and EC level H - a staggering 2.43kB of redundancy vs. 1.28kB of data! See this particular sample: https://qris.cool/decode?sample=135