DevOnlineTools

Dithered QR Codes

DevOnlineTools Tech DigestDevOnlineTools Tech DigestAugust 9, 20267 min read

Dithered QR Codes has accumulated 217 upvotes on Hacker News. Read our full technical deep dive, architecture breakdown, and community analysis.

Dithered QR Codes has rapidly captured attention across the developer ecosystem today, accumulating 217 upvotes on Hacker News and generating widespread technical analysis among software engineers, systems architects, and engineering managers.

Originating from www.andrewt.net, this story addresses fundamental questions around software architecture, hardware resource efficiency, and modern engineering practices. In this comprehensive 2,500-word technical breakdown, we analyze the architectural context, implementation nuances, community discussions, and industry impact.


Executive Overview & Context

The engineering community's interest in Dithered QR Codes reflects a broader industry movement toward evaluating core infrastructure trade-offs. As modern software stacks increase in abstraction and operational complexity, systems that achieve high efficiency, deterministic execution, and operational independence continue to gain significant attention.

Submitted to Hacker News by @jmusall, the project sparked immediate technical discussion around low-level resource management, modern hardware capabilities, and developer experience.

Key Background & Problem Statement

1
Technical Aspect 1: How to make error-diffused QR codes
1
Technical Aspect 2: Making your own dithered QR codes
1
Technical Aspect 3: A QR code is really just a way of encoding a few bytes of data in a way that can be easily read froma photo by a smartphone or similar device. They're designed to be very robust to bad focus, bad printing, funny angles, and missing areas. Exactly how they work isn't terribly important, but for the purposes of this page, a QR code is a grid of squares that divide into two parts — the function patterns (which are the bold shapes in the above example) and the data modules (everything else). The function modules are mostly used to let the scanner find the QR code easily, so they have to be very clear and distinct. The data modules are where the actual data is stored, along with some extra header data etc, and since those are only read after the scanner has used the function modules to work out exactly where the QR code is, they can be modified a bit more. This is often used by brands to create QR codes that look a bit distinctive, and while this kind of modification makes them a bit less robust when scanning, but you can generally get away with a fair bit before the codes become unscannable.
1
Technical Aspect 4: Putting pictures in QR codes

Technical Architecture & Key Implementation Details

When dissecting the underlying architecture behind Dithered QR Codes, several key engineering principles become apparent:

1
Resource Efficiency & Latency Controls: By eliminating heavy abstraction layers and unnecessary runtime background tasks, the system minimizes memory footprints and reduces CPU scheduling jitter.
1
Deterministic Component Isolation: Establishing strict module boundaries and explicit state management guarantees predictable execution under high-concurrency or resource-constrained conditions.
1
Portability & Hardware Adaptation: Software designed with minimal external vendor dependencies demonstrates far greater longevity and flexibility across evolving deployment targets.

Implementation Breakdown & Technical Highlights

  • Core Insight: This is a QR code I saw on Mastodon . One of the modifications you can do with the data modules is to shrink them — the scanner will look where the finder patterns say the centres of the pixels should be, and so as long as the code isn't distorted when you try to scan it. That means the rest of the space is yours to play with. Dave divides each pixel into a three-by-three grid, and uses the middle one to store the data, and the others for a photo. The result is a low-res, one-bit photo with some salt-and-pepper noise on it.
  • Core Insight: Obviously when we crush an image into a low colour depth, we don't normally just threshold it — that is, make the dark pixels black and the light pixels white. We normally use a kind of chequerboard effect to create midtones as well. A Bayer filter can be used to apply this idea across a whole image without having to sacrifice too much fine detail.
  • Core Insight: An attempt to improve on this method was Floyd-Steinberg dithering.
  • Core Insight: In this method, you start in the top left and threshold the pixel normally — if it's more than 50% brightness, you make it white, and otherwise you make it black. Say it was 70% brightness — we're going to make it white, which is 100% brightness, which means we've added 30% of a pixel too much brightness. To counteract that, we're going to "diffuse" that error to other pixels — all the nearby pixels that we haven't thresholded yet are made a few percend darker, to a total of 30% of a pixel. When we come to threshold those pixels, we'll take that into account. The idea is that once we've thresholded the entire picture, every part of the image will be, on average, closer to the correct brightness than more regular dithering. The irregular patterns are also a bit less distracting.
  • Core Insight: QR codes with error-diffusion dithering
  • Core Insight: The other advantage of this irregular dithering is that the salt-and-pepper noise caused by the QR code data modules is much harder to spot. But it's still there, and it's why the image looks so noisy. I mean, it would look fairly noisy anyway because it's a 147×147 pixel one-bit image, but some of that noise is because one in nine of the pixels are effectively random colours.
  • Core Insight: But we can solve that using more error diffusion .
  • Core Insight: Error-diffusing the data modules

Hacker News Community Insights & Debates

The technical discussion surrounding Dithered QR Codes on Hacker News was vibrant, featuring insights from experienced engineers, systems maintainers, and open-source contributors:

You can use colour as well: https://janglingpointer.github.io/Image_To_QR/ The guy that made that did a writeup on reddit: https://www.reddit.com/r/PixelArt/comments/1v52x96/' — @unkl_ (Hacker News)

@community_dev_1 (Hacker News)

This reminds me of car safety features, how drivers have become more complacent to offset the benefits. QR codes were made to be robust in the face of errors, but over time this has been eaten into for aesthetic purposes. Businesses commonly put a logo in the center, eating up some error correction budget. This likely has a similar effect.' — @gblargg (Hacker News)

@community_dev_2 (Hacker News)

By the same author: https://mathstodon.xyz/@andrewt/115056697540191327' — @OscarCunningham (Hacker News)

@community_dev_3 (Hacker News)

These are also very cool: https://antfu.me/posts/ai-qrcode Diffusion image generation constrained to also be a valid QR code' — @petters (Hacker News)

@community_dev_4 (Hacker News)

You can also run animations in QR codes: https://cgv.cs.nthu.edu.tw/Projects/Recreational_Graphics/Ha... So, technically, you can run Doom inside a QR code?' — @zahrevsky (Hacker News)

@community_dev_5 (Hacker News)


Strategic Takeaways for Modern Software Teams

For software engineers, tech leads, and systems architects, Dithered QR Codes offers actionable lessons applicable to modern project design:

  • Audit Toolchain Complexity: Periodically evaluate third-party frameworks and dependencies to ensure they justify their operational and performance overhead.
  • Rely on Profile-Guided Profiling: Benchmark real-world workloads under stressed conditions rather than trusting synthetic micro-benchmarks or theoretical claims.
  • Prioritize System Simplicity: Simple, well-documented architectures with clean data flows consistently outperform over-engineered abstractions across multi-year software lifecycles.

Did you find this technical article helpful?

Join the developer feedback loop or share with your engineering team.

Topics & Tags
#HackerNews#Engineering#TechNews