How we built a browser image compressor that never makes files bigger
说明与用途
完全在客户端运行的图像压缩器,保证文件大小不增大,并将结果打包为 ZIP。
问题
Ensuring that a browser‑side image compressor never increases file size while supporting multiple formats and preserving user privacy.
结果
The compressor processes images entirely on the client, never enlarges files, and provides a ZIP of results, preserving privacy and performance.
工作流
- 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
证据
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.
- 记录日期: 2026-10-20T12:41:34.761Z