Airfrog editorial team ·

Reading Damaged QR Codes: SDK Capabilities and Limits

How to choose a library for scratched, partly covered QR codes and print defects. Finder-pattern damage, quiet zones, Python tests, and recovery limits.

When a damaged QR code can still be read

QR error correction can recover some damaged data, but it does not guarantee that every damaged code can be read. The correction level, damage pattern, number of surviving modules, and ability to locate the grid all matter. A scratched label, packaging that covers part of a code, and a blurred frame need different checks.

Do not turn the error-correction level into a promise that any image can be covered up to a certain percentage. Damage to function patterns and missing data impose different limits. If part of the text is physically unrecoverable, changing libraries cannot recreate it.

Airfrog's own comparison includes occlusions and damage. That is a reason to test it on your labels, not a guarantee that it will recover every frame. See DENSO WAVE's overview of QR Code structure and error correction.

Damaged finder patterns and covered modules

The three large finder patterns help locate a QR code's orientation. Damage to a finder pattern can prevent detection even when some data modules remain. Covering the center and covering a corner are different test cases. Label them separately and record how much of the code is damaged.

For a partly covered QR code, check whether another capture shows less of it covered. Do not fill in guessed modules by hand or assume a returned string is correct just because a decoder produced one. Compare it with the expected content and label position.

QR codes without quiet zones and print defects

The quiet zone separates a QR code from nearby elements. Cropping, text too close to the code, ink spread, and low contrast can make its boundary and grid harder to find. The QR Code Model 2 specification calls for a four-module-wide quiet zone; see DENSO WAVE's printing guidance.

If the problem recurs on newly printed labels, improving print quality may help more than adding decoder retries. Adding a white border in software cannot restore modules that have already been cropped. Compare the source frame with the processed version so preprocessing does not hide a print defect.

How to test a damaged QR code library with Python

Pass the source bytes to QRDecoder().decode_all(image_bytes). The Python API example shows the input, errors, and result. For each file, prepare the expected text and coordinates, including frames with multiple labels. Add clean images and frames with no QR codes as well.

  1. Count fully decoded frames, missed codes, and extra results.
  2. Separate finder-pattern, data-module, and quiet-zone damage.
  3. Measure the time for every attempt, including failures.
  4. Set a threshold for when to recapture the image or handle it manually.

The decoder comparison can help you choose candidates. For perspective, blur, and lighting, use the separate guide to image distortion: sharpening does not solve the same problem as damaged print.

Scratched, covered, or poorly captured: how to tell the difference

These issues can look alike in a photo, but they need different fixes. If a fold in the film covers the code, a different camera angle may reveal the modules. If ink or a scratch removed them, another angle cannot restore the print. If blur merged their edges, start with a sharper photo.

What to check on a damaged label
What you seeNext check
A bright spot on the filmChange the light or camera angle and check the same area without glare.
A tear or scratchMark the damaged areas and check which QR structures remain.
Black modules running togetherCompare the printed original with the photo; check focus and ink spread.
The code touches text or an edgeCheck the quiet zone and whether the QR code itself was cropped.

For a recurring defect, keep several labels with different levels of damage and a clean print of the same type. Get the expected content from the system that produced the label or another verifiable source. A string returned by one decoder is not ground truth for evaluating the others.

Your application still needs to validate the meaning of a decoded result. For example, a box ID should exist in the inventory system and belong to the expected operation. This separates successful text recovery from an incorrect item confirmation.

Damaged QR code FAQ

Can a QR code be recovered from part of a photo?

Sometimes the remaining data and function patterns are enough to read it, and sometimes they are not. The visible area alone does not tell you: which modules and finder patterns remain matters. Pass the original to the decoder and compare its result with known content.

Will enlarging the image help?

Enlarging changes how existing pixels are represented and may affect a particular algorithm. It cannot restore erased print. Keep the original file and test whether the transformation helps the full group of damaged images.

Should I change the library or improve label printing?

If the defect recurs during printing, start with label quality and quiet zones. For packages already in circulation, compare decoders on real examples of the defect. Choose based on correct recoveries and the cost of handling failures again.