How we built a browser image compressor that never makes files bigger
Description and use
A client‑side image compressor that never increases file size and packages results into a ZIP.
Problem
Ensuring that a browser‑side image compressor never increases file size while supporting multiple formats and preserving user privacy.
Outcome
The compressor processes images entirely on the client, never enlarges files, and provides a ZIP of results, preserving privacy and performance.
Workflow
- Select or drag‑drop images
- Choose target format or keep automatic
- Set quality and resize options
- Compressor decodes with createImageBitmap
- Generates candidate encodings (WebP, JPEG, PNG)
- Selects smallest blob that is smaller than original
- Returns original if no smaller candidate
- Packages results into a ZIP via JSZip
- Downloads ZIP or individual file
Evidence
Our compressor accepts a batch, starts processing immediately, and returns either a smaller encoding or the original file.
The size guarantee belongs after candidate selection. It must also apply after resizing, forced conversion, and preprocessing.
Each worker receives a file, options, and a job identifier. It returns either the result or an error carrying that identifier.
- Record date: 2026-10-20T12:41:34.761Z