I Built a Text Remover, Then Measured Where It Breaks
A photo with text on it is not two layers. The letters were recorded with the scene, so there is no original underneath waiting to be revealed. Any "removal" is a reconstruction: the surrounding texture gets continued ac
A photo with text on it is not two layers. The letters were recorded with the scene, so there is no original underneath waiting to be revealed. Any "removal" is a reconstruction: the surrounding texture gets continued across the area the letters occupied.
That single fact decides which uploads a text remover can help and which it cannot. I built a small one and then measured where it breaks, and three numbers ended up shaping the design more than any feature request.
Step one is detection, not inpainting
The pipeline is short: find the text, build a mask, rebuild the masked region from its surroundings.
Most of the failures people report are failures of step one. On a phone photo the date stamp is usually a small line of orange digits in a corner, so a detector can look for that shape and colour. Feed it a brand printed across a product package and nothing matches β the tool returns the image unchanged, and the user reads that as "it did nothing" rather than "it found nothing".
I fixed that with wording, not with a model: when auto-detection finds no candidate, say so and hand over the manual box. Users forgive a tool that admits it missed; they do not forgive a tool that returns their photo untouched without explanation.
Step two: the mask is where you lose
The mask is the only real control the user has, and the most common mistake is drawing it generously.
A selected pixel is discarded. Every pixel of margin you add is real texture the reconstructor is not allowed to sample from. People pad the box "to be safe" and end up with less information than if they had hugged the letters.
The second mistake is feathering. A soft mask tells the algorithm the outer pixels are only partly gone, so it blends real texture with invented texture, and you get the grey halo that everyone blames on the algorithm.
Step three: three measurements
Background noise decides whether the rebuild is visible at all.
I measured the local noise level around the mask on three test photos: sigma of roughly 7.25, 7.27 and 7.28 grey levels, with the ring just outside the mask between 7.17 and 7.28. A rebuild that comes back flatter than 7 grey levels of noise reads as a smudge even when the colour matches perfectly, because what the eye notices is the grain stopping.
Synthetic noise can only paper over the seam up to a point.
In my compositing pass I could only inject about +5 to +8 grey levels before the patch stopped looking like the rest of the photo. That sets a hard ceiling on how much of the "too clean" problem post-processing can fix.
The weight has to fall off where the original frequency content is high. I scale the correction by weight = min(1, sigmaRef / |high|). On a white caption over dark asphalt, local high-frequency content around the letters runs +100 to +150 grey levels, so the weight collapses to about 0.05 β the correction effectively turns off exactly where a naive approach would smear.
The visible consequence is honest: white text on a dark, busy surface leaves a soft dark patch. No threshold fixes that; the information simply is not there.
What it cannot do
- Paragraphs, document pages, logo patterns. Too little trustworthy texture left to continue from.
- Patterns with a strong grid: checks, weave, tiles. The pattern has to be inferred, not sampled, so a seam is the expected outcome.
- Large areas. Beyond a few dozen pixels in each direction the rebuild converges on average colour.
What it can do: a single short printed line on an even or smoothly graded surface β a date stamp in the corner, a stock code on a panel, a price on a label.
Four rules that survived
- Hug the letters. No margin, no feather.
- Judge at 100% zoom, never in a thumbnail.
- Match the method to the surface: clone from an aligned region on patterns, reconstruct on flat ones.
- Tell the user when detection found nothing. Silence looks like a bug.
I packaged this as a small browser tool for the narrow case above β short printed lines, two free photos a day, no signup. If you want to compare it against your own attempts on the same file, the remove text from photo page explains the workflow and where the limits sit.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.