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