Batch image compression: hitting a target file size without guessing quality
Every image tool asks you for a quality number between 1 and 100, and almost nobody knows what to type. The number is not a
percentage of anything you can see — it is an encoder parameter that controls how aggressively detail is thrown away. The same
value produces wildly different file sizes on a flat illustration and on a photo of leaves.
What you usually actually want is a size
Upload limits are stated in kilobytes. Page-speed budgets are stated in kilobytes. Email attachments are stated in megabytes. So
the useful question is not "what quality?" but "make this fit under 200 KB and keep it as sharp as you can".
That is what target-size mode does: it binary-searches the quality parameter, re-encoding until the result lands just under your
limit. A handful of encode passes in a worker is far faster than a human dragging a slider and re-checking the file size.
Batch is the normal case
Nobody compresses one image. You have a folder of product photos, a set of screenshots for a store listing, or every asset in a
blog post. Processing them in one pass and downloading a single ZIP removes the tedious part — and because the encoding happens in
your tab, there is no upload wait and no queue.
Format matters more than quality
- WebP is roughly 25-35% smaller than JPEG at matching visual quality, and every current browser supports it.
- AVIF is smaller still, especially on photos, at the cost of slower encoding.
- JPEG remains the safe fallback for email, older tooling and anything that must open everywhere.
- PNG should only survive when you need transparency or crisp flat colour; a photo saved as PNG is usually a mistake.
A practical routine
- Resize first. A 4000px photo displayed at 800px wastes bytes no encoder can win back.
- Convert to WebP unless you have a compatibility reason not to.
- Set a target size that matches your budget rather than a quality guess.
- Compress the whole batch, grab the ZIP, and spot-check the two most detailed images.
Everything above runs locally in your browser tab. Your photos are never uploaded, which matters when the batch happens to include
client work, screenshots with data in them, or anything under NDA.