Dithered QR Codes: How to Hide a Photo in a Scannable Code

Dithered QR Codes: How to Hide a Photo in a Scannable Code

QR codes can be made to look like dithered photos by replacing the data modules with image pixels. This page explains the basics of QR code structure, then shows how to use Floyd-Steinberg error diffusion to mask the required data modules, producing a cleaner image. It also covers advanced tricks like rotating the code or allowing a few data modules to be changed, and warns about the trade-off between aesthetics and scannability in real-world use.

The error will potentially be quite big — normally we get to choose the colour so the error can never be more than 50%, but here we might have to make a pixel in a dark area pure white and end up creating 95% error.
  1. 0sp

    Russ Cox’s QArt Codes[0] modifies how the URL is encoded to embed an image while keeping the QR code fully valid, without relying on error correction.

    [0] https://research.swtch.com/qart

    Related QArt discussions on HN:

    [1] https://news.ycombinator.com/item?id=15213044 (2017-09-10, 61 points, 6 comments)

    [2] https://news.ycombinator.com/item?id=3836935 (2012-04-13, 56 points, 9 comments)

    [3] https://news.ycombinator.com/item?id=8549772 (2014-11-03, 56 points, 4 comments)

  2. unkl_

    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/

  3. zellyn

    I always think of Russ Cox’s blog posts as canonical here: https://research.swtch.com/qart

  4. gblargg

    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.

  5. dhosek

    I played around with this a bit, first I did a photo of a cat I just took at a cat cafe, but the black and white cat didn’t turn out well with the dithering algorithm, so then I tried a selfie and pushing the radius up, it came out looking good, but then I tried aiming my iPhone camera at the screen and it didn’t see a QR code, only the face from the selfie. The ones on the main page, though, worked fine.

More from this day

2026-08-09