How Does Our Target Size Algorithm Work?
Unlike crude online tools that guess a static compression level or fake file sizes, ImageTools Pro uses a genuine binary-search optimization algorithm:
- The engine evaluates your target byte limit (e.g. 50 KB = 51,200 bytes).
- It executes a binary search across JPEG/WebP compression quality matrices (from 5% to 98%).
- After each test render, the resulting Blob is measured in exact bytes.
- If the file is still larger than the target at minimum quality, the algorithm gradually reduces pixel dimensions by 15%–20% and repeats the quality optimization loop.
- The process converges on the closest technically achievable file size within target limits.
Why PNG Files Behave Differently
PNG is a lossless compression standard that uses DEFLATE filtering. The PNG specification does not support lossy quality quantization parameters. To reduce a PNG's file size to a specific target in KB, the tool must scale down its pixel dimensions, or you can switch the output format to JPEG or WebP for optimal size reduction.