« All posts

Why image compressors fail forms that require a minimum file size

Upload forms often demand a min-max photo size range, not a ceiling. Here's why compressors fail it, and how JPEG padding fixes it safely.

Many government and university application portals specify a photo size range, not just a ceiling — say, 20-50 KB, at 200×230 pixels. Nearly every popular compression tool only targets a maximum size, so when the required dimensions are small, a clean JPEG of a face naturally lands around 10-15 KB, falling under the floor before any compression is even applied. Users see an opaque rejection despite following every visible rule correctly.

The fix has two layers. Reversing the usual binary search to target the largest file under the ceiling, rather than the smallest, often clears the minimum for free while improving image quality. When even full quality can't reach the floor, padding the JPEG's COM comment segment with filler bytes increases file size without touching a single pixel — but any tool doing this should disclose it rather than hide it. Reading back the SOF header to confirm dimensions and segment integrity is a reliable way to verify nothing was corrupted in the process.

A second, unrelated failure mode also surfaces: iPhone photos shared via AirDrop or WhatsApp often keep a .jpg extension while remaining HEIC internally. Detecting the real format requires checking the ISO-BMFF ftyp brand bytes rather than trusting the file name — and HEIC decoding support itself varies across browsers, working on Safari but silently failing on Chrome and Firefox. A planned table of per-exam size presets was deliberately left out, since published specs contradict each other across sources and change between recruitment cycles.