20KB works out to roughly 160,000 bits for the entire image. Spread that across even a modest 800 by 600 photo and there's only a tiny fraction of a bit available per pixel. No amount of turning down a quality slider alone gets a real photo down to that budget, since the format still needs some minimum amount of information to describe each block of pixels no matter how aggressive the setting.
Why quality alone can't get you there for a photo
JPEG compresses in 8 by 8 pixel blocks, and even at the lowest usable quality setting, each block still needs a minimum number of bits to describe it. Once a source photo has more of these blocks than the target byte budget can support, quality alone runs out of room. The only way to shrink the file further at that point is reducing the actual pixel dimensions before compression, not pushing the quality number any lower.
Line art and signatures don't hit this wall
A signature scan or a simple line drawing is mostly flat white background with a small amount of dark line data. JPEG's compression finds huge blocks of nearly identical pixels to describe efficiently, so a legible signature can genuinely fit under 20KB at its original dimensions without needing the aggressive downscaling a full photo would require to hit the same target.
What the binary search is actually doing
The tool doesn't guess a single quality number and stop. It repeatedly tries different quality and dimension combinations, checks the resulting file size each time, and narrows in on the highest quality setting that still lands under your target. That's why the same 18KB target can produce very different-looking results depending on what's actually in the source image, a signature keeps its full size and stays sharp, while a busy photo gets both compressed and shrunk to make the same budget.