Quality does not predict bytes
Lossy encoders usually accept a quality value, but the resulting byte size depends on the image. A detailed photograph and a flat illustration can produce very different sizes at the same quality.
That is why a 200 KB mode cannot simply map to one magic quality percentage. It must encode, measure and adjust within a bounded search.
An illustrative search
Suppose a 3000 × 2000 photograph starts at 2.8 MB and must fit under 200 KB. The compressor first tests qualities inside a safe range. If 74 produces 218 KB and 71 produces 194 KB, 71 is the best tested result under the ceiling—not proof of a mathematically perfect global optimum.
If even the lowest allowed quality remains over 200 KB, Smart Fit can reduce dimensions proportionally and repeat the search. CompressByURL stops at a documented shorter-edge floor rather than shrinking indefinitely.
| Attempt | Illustrative result | Decision |
|---|---|---|
| Quality 82 | 286 KB | Over target |
| Quality 74 | 218 KB | Over target |
| Quality 71 | 194 KB | Keep as best tested pass |
| If all fail | Still over 200 KB | Offer proportional Smart Fit |
What an honest target tool must say
The example values above illustrate the decision path; they are not a benchmark or promised output for another image.
- A byte ceiling can require visible loss; no tool can guarantee otherwise.
- Very small targets may require fewer pixels, not just lower quality.
- Lossless PNG has no meaningful lossy quality search unless you convert formats.
- The correct failure state is explicit: target not reached within the allowed bounds.