Compress Image to a Size
Give it a budget in KB and it finds the best quality that fits. For the 100 KB upload limit, the 2 MB email cap, the marketplace rule.
How it works
Open the image
Read at full resolution.
Type the budget in KB
An email limit, an upload cap, a marketplace rule.
Download
The largest file that still fits under it.
Compress image to 100kb: compress image to 50kb, compress image to 20kb
Type a budget and it finds the best quality that fits: compress image to 100kb for upload forms, compress image to 50kb or compress image to 20kb for strict portals, compress image to 200kb for web pages, or compress jpeg to 1mb for email.
Why it matters
It hits the number you asked for
Quality percent is the wrong dial for "make this 100 KB", because the quality that lands on 100 KB is different for every picture.
Bisection, not stepping
File size is not linear in quality, so the search halves the range each time. About eight encodes covers the whole range to within a percent.
It scales only when it must
If no quality setting fits, there is no quality left to give and the only thing that reduces bytes is fewer pixels. That happens last, and it is stated in the result.
It refuses rather than pretends
If the budget cannot be met at all, you are told. You do not get an oversized file described as a success.
Questions
Why is my file smaller than the budget?
The budget is a ceiling. The search returns the largest file that stays under it, so a little headroom is normal.
Can I do this with a PNG?
PNG is lossless, so there is no quality dial. A PNG is re-encoded as JPEG unless it has transparency to protect.
What if it cannot reach the budget?
It says so, and suggests cropping or a larger budget, rather than handing back a file that does not fit.