QR code repair
Rescue a QR code that will not scan: contrast stretch, adaptive thresholding and morphological denoising, verified with jsQR — with the before/after decode results shown side by side.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Choose a QR image to repair
The image is processed locally in the browser and never uploaded.
PNG / JPEG / WebP. Low-contrast screenshots, noisy or unevenly lit images all work.
Repair result
Pipeline: contrast stretch → adaptive threshold → morphological denoise → jsQR verification.
Pick an image, then press Repair.
What this tool does
- A screenshot where the QR code is almost the same shade as its background — repair it before scanning.
- Phone photos with glare and noise: denoise and threshold them into a clean bitmap.
- Scanned printouts with poor quality: repair them before forwarding or reprinting.
- Normalise images ahead of an OCR or scanning pipeline so the recogniser behaves.
Example
Input
A 148 × 148 QR PNG with black modules at grey 120, white at 145 and ±6 noise on top
Output
Grey range 114–151; adaptive threshold radius 24 px, tolerance 0.05; it fails before and decodes https://unikit.cc/tools/qrcode-repair after
The before/after result is real: the unit test first asserts jsQR returns null on the original, then asserts the repaired image decodes.
Frequently asked questions
What exactly does the repair pipeline do?
Four steps: (1) contrast stretch, mapping the actual grey range (say 114–151) linearly onto 0–255; (2) adaptive thresholding, using an integral image to compare each pixel against its neighbourhood mean, so unevenly lit images get a local threshold; (3) 3×3 morphological denoising — an open then a close — to drop isolated black specks and fill isolated white holes; (4) jsQR verification of the result.
How do I know the repair worked?
The result panel shows both the before and after decode results. If it failed before and returns content after, the code was rescued; if both decode, the original was already readable.
How should I tune radius and tolerance?
Radius is the neighbourhood size in pixels for adaptive thresholding: bigger images and more uneven lighting want a bigger radius, roughly 1/20 to 1/10 of the image width. Tolerance is how far below the neighbourhood mean counts as black; raise it (0.08–0.12) for noisy images, but too high eats thin strokes.
What if it still will not decode?
Usual causes: a corner or one of the three finder patterns is cropped off, resolution is too low (under 2 px per module), or there is heavy perspective distortion. Those cannot be fixed at pixel level — you need a better image. This tool does no perspective correction or deblurring.
Keywords:qrcode repairjsqr