How target KB compression works
JPG and WebP files are saved with a quality value between 0 and 1. A lower quality removes more fine detail and produces a smaller file. Instead of guessing, ImageCompressor runs a binary search: it encodes the image at a middle quality, measures the exact byte size, then halves the search range up or down. After about nine steps it lands on the highest quality that still fits under your limit.
If even minimum quality is too large — for example, compressing a 12-megapixel photo to 20 KB — the tool scales the pixel dimensions down step by step and searches again, so you always get a file that meets your target.