How dithered QR codes hide pictures inside scannable squares

Dithered QR codes blend a halftone image into a code’s black-and-white grid. The technique leans on built-in error correction and on how scanners sample.

Dithered QR codes blend a halftone image into a code’s black-and-white grid. The technique leans on built-in error correction and on how scanners sample each module, so the symbol still decodes while carrying a visible picture.

Key takeaways

  • A dithered QR code is an ordinary QR symbol whose modules have been arranged or rendered so that the overall pattern also reads as a halftone image.
  • The approach works because the QR standard includes Reed–Solomon error correction, which lets a decoder recover the payload even when part of the symbol is altered or obscured.
  • Dithering is a long-established printing and imaging method for approximating grey tones using only black and white marks, and it maps naturally onto a grid of two-tone modules.
  • The main trade-off is reliability: the more image detail a designer pushes into the grid, the smaller the margin left for real-world damage, poor lighting or awkward scanning angles.
  • Anyone experimenting with the technique should test the finished code across several phones, camera apps, print sizes and lighting conditions before using it anywhere it matters.

What is a dithered QR code?

A standard QR code is a grid of black and white cells, usually called modules. Some of those modules are fixed structural elements — the large square finder patterns in three corners, the alignment and timing patterns, and the format and version information. The rest carry encoded data and error-correction codewords.

A dithered QR code keeps that structure but treats the grid as a canvas. The designer starts from a source image, converts it to a two-tone halftone using a dithering algorithm, and then tries to make the code’s modules agree with that halftone wherever possible. Where a module cannot be changed without breaking the code, the original value stays. The result is a symbol that a scanner still reads as data, while a human eye reads it as a coarse, grainy picture.

There is no single canonical method. Some implementations render each module as a small dot at its centre and use the surrounding space for image detail. Others subdivide each module and require only the central sub-module to match the encoded bit. Others simply flip modules within the budget that error correction allows.

Why is the technique circulating now?

Image-bearing QR codes are not new as an idea, and variations have appeared in research literature, hobby projects and commercial design tools over a number of years. What tends to push a specific implementation into wide discussion is a fresh write-up or an open tool that makes the process reproducible without specialist software.

That is the usual pattern behind a technical link gathering attention on aggregator sites: a clear explanation, a working demonstration, and a result that is visually striking enough to be shared. The precise origin of any given implementation, and how novel it is relative to prior work, is not something a reader should assume from a headline count of votes and comments. Where credit sits, and whether a particular method is genuinely new, is often exactly what the accompanying comment threads argue about.

The background a newcomer needs

Two mechanisms make the trick possible.

The first is error correction. The QR specification, standardised as ISO/IEC 18004, defines four error-correction levels. The lowest tolerates only a small proportion of corrupted codewords; the highest can restore roughly a third of them. That headroom exists so codes survive smudges, creases and partial occlusion — but the same headroom can be deliberately spent on decoration. Encoding at the highest level therefore gives the most freedom to alter modules, at the cost of a physically larger symbol for the same payload.

The second is how decoders read an image. A scanner locates the finder patterns, corrects for perspective, converts the picture to black and white using a threshold, and then samples each module — often near its centre rather than averaging the whole cell. That sampling behaviour is what allows sub-module tricks: if only the middle of a cell determines the decoded bit, the edges can carry image information almost for free.

Dithering supplies the third piece. Error-diffusion methods such as Floyd–Steinberg, and ordered or blue-noise dithering, all convert continuous tone to binary marks while spreading the resulting error so the eye perceives intermediate greys. Applied at module or sub-module resolution, they turn a photograph into something a QR grid can approximate.

How to build one, step by step

A workable sequence, using generally available tools, looks like this.

Choose a short payload. A compact URL produces a smaller symbol, which leaves more physical room per module and improves scanning. Encode it at the highest error-correction level.

Prepare the image. Crop to a square, raise contrast hard, and reduce it to a small pixel count matching the code’s module count — or a small multiple of it if you plan to work at sub-module resolution. Fine detail will not survive; silhouettes, logos-in-outline and high-contrast portraits fare best.

Dither the image to pure black and white at that resolution, then overlay it on the encoded matrix. Preserve the finder, alignment, timing and format regions untouched, and preserve the quiet zone — the blank margin around the symbol, which decoders rely on.

Decide which remaining modules to flip. A simple approach flips only modules that the error-correction budget can absorb. A more capable approach re-encodes the payload repeatedly, varying padding bytes, mask pattern or a redundant URL parameter, and keeps whichever candidate matches the target image best.

Then verify. Decode the result with several independent scanners, print it at the size you intend to use, and test at different distances and under artificial light.

Who is affected and how

Designers and marketing teams are the obvious audience, since the appeal is aesthetic. Print producers are affected too, because ink spread, paper texture and screen glare all erode the margin that decoration has already consumed.

End users are affected indirectly. A decorative code is more inviting to scan, and QR codes have been a recurring vector for phishing, since the destination is invisible until the phone resolves it. Anything that increases willingness to scan unfamiliar codes has a security dimension worth acknowledging.

Accessibility is a further consideration. A code that scans only at close range, in good light, on a recent phone, excludes users with older hardware or reduced vision, and there is rarely a visible signal that a code is marginal rather than broken.

Where informed people disagree

Practitioners split along a few lines. One camp treats error-correction headroom as a safety reserve that should never be spent on ornament, arguing that codes are printed once and encountered in unpredictable conditions. Another treats the reserve as a design resource, on the grounds that a code which is never scanned because it looks like clutter has already failed.

There is also disagreement about method. Sub-module rendering can produce far better images, but it depends on decoder behaviour that the standard does not guarantee — implementations differ, and a code tuned to one scanner may be weaker on another. Search-based re-encoding is more conservative but slower and more limited in image fidelity.

Finally, opinions differ on whether the images are worth it at all, given that most halftones at module resolution are legible only from a distance or when the viewer already knows what they depict.

Practical implications

Treat any dithered code as a design artefact requiring quality assurance, not a graphic that is finished when it looks right. Keep the payload short, keep the quiet zone, keep contrast high, and set a minimum print size based on tested scanning distance rather than layout convenience.

Where a code carries something consequential — a payment, a login, a safety instruction — the conservative choice is a plain symbol, possibly with a small clean logo in the centre, which is the mildest and best-supported form of the same idea. Keep a plain fallback and a printed URL alongside decorative codes wherever space permits.

What to watch next

Watch for open tooling that packages the whole pipeline, since accessibility of tools determines how widely a technique spreads. Watch how phone camera apps and operating-system scanners evolve, because changes to their binarisation and sampling can quietly break codes that once worked. And watch whether guidance from standards or accessibility bodies begins to address decorative codes explicitly — at present, published advice tends to address contrast, size and quiet zones rather than embedded imagery.

Frequently asked questions

Does a dithered QR code still scan normally?

Usually, but with less margin. The code remains a valid QR symbol, so a compliant decoder should read it. However, the error-correction capacity that would otherwise absorb dirt, glare, creases or motion blur has been partly spent on the image. In good conditions the difference may be invisible; in poor light, at an angle, or at small print sizes, a dithered code will fail sooner than a plain one.

Which error-correction level should I use?

The highest available level gives the largest budget for altered modules and is the usual choice for image-bearing codes. The trade-off is size: higher error correction adds codewords, so the symbol needs more modules for the same payload, which means either a physically larger code or smaller modules. Shortening the encoded URL is the most effective way to offset that growth.

Can I put a photograph in a QR code?

Only in a very reduced form. The grid is coarse and strictly two-tone, so continuous-tone detail cannot survive. High-contrast subjects with a clear silhouette work best, and images are typically most legible when viewed from a distance, where the eye blends individual modules. Expect to crop tightly, raise contrast aggressively and accept an impressionistic result rather than a recognisable photograph.

Is this different from putting a logo in the middle of a code?

Yes, though the underlying principle is shared. A centred logo simply covers modules and relies on error correction to reconstruct the hidden data. A dithered code modifies modules across the whole symbol so the pattern itself forms the image. The centred-logo approach is simpler, better supported by common tools, and generally more robust, which is why it remains the mainstream option.

What tools do I need to try this?

A QR encoding library that exposes the raw module matrix and lets you set the error-correction level, plus any image tool that can dither to black and white at a chosen resolution. Some libraries and design applications offer image-embedding directly. The essential extra step is a verification pass with multiple independent decoders, since the encoder cannot tell you how a real phone will behave.

Are decorative QR codes a security risk?

The technique itself does not change what a code contains. The indirect concern is behavioural: attractive codes invite scanning, and a QR code’s destination is not visible before it resolves, which has made codes a recurring phishing vector. The usual precautions apply — check the URL preview your phone shows, be wary of codes stuck over existing signage, and avoid entering credentials from a link reached by scanning.

Sources and further reading

  • The international standard governing QR symbols, which defines symbol structure, versions, masking and error-correction levels.
  • Published academic work on halftone and image-embedded two-dimensional barcodes, which describes sub-module rendering and search-based encoding approaches.
  • Documentation for open-source QR encoding libraries, which specifies how error-correction levels, masking and raw matrix access are exposed.
  • General references on digital halftoning and error-diffusion dithering, covering the algorithms used to convert continuous tone to binary marks.

Surfaced from the hackernews signal “image-embedded QR code technique”. AI-assisted draft, editorially reviewed.

Visited 1 times, 1 visit(s) today
share this recipe:
Facebook
X
WhatsApp
Telegram
Email
Reddit