Compressing and converting images without ruining them
Updated 2 November 2026 · 8 minute read
“Please upload a photograph of at least 20 KB and not more than 50 KB.” A sentence like that turns an ordinary photo into a puzzle. The file is 3 MB, the form accepts a narrow window, and the software on your phone offers a quality slider with no numbers on it. This guide explains what actually makes an image file large, how a compressor can aim at an exact size, how JPG differs from PNG and WebP, and what to do when a form rejects the result anyway. The two tools that do the work are the image compressor and the image converter.
Why an image is as large as it is
A digital image is a grid of pixels, and each pixel has a colour. Stored raw, a 12-megapixel photo would need roughly 36 MB, because each pixel carries three colour values. Files are far smaller than that because compression finds repetition and removes detail the eye is unlikely to notice. Every image format is a different bargain about which detail to keep.
Three quantities dominate the size of the final file:
- The number of pixels. A 4000 × 3000 photo has 12 million pixels; a 480 × 360 version has about 173,000 — roughly 1.4% as much data. Cutting dimensions is the most powerful lever, and it is also the one that users skip.
- The encoder quality. Lower quality means coarser colour and detail coding. The saving is large at first and flattens out; the visible damage is usually mild until the setting gets low, then edges and text fall apart quickly.
- The content. A plain background compresses almost for free. Paper texture, noise, foliage, fabric patterns and fine text are expensive. This is why the same 20 KB limit can look fine for one signature and terrible for another.
Format matters too, but less than people expect at very small sizes: a 4000-pixel photo cannot be squeezed into 20 KB in any format without becoming a blur. Dimensions have to come down first.
What a target-size compressor does
A quality slider asks you to guess. A target-size compressor works backwards from the limit:
- Read the image once at full resolution. The EXIF orientation tag is applied, so a phone photo taken sideways appears upright.
- Resize to your long-edge limit. If you choose 480 px, the longest side becomes 480 px and the other side keeps its proportion.
- Binary-search the quality. The tool encodes the resized image at several quality levels and keeps the highest one whose file is at or below the target. Seven attempts usually land within a few percent of the best possible quality.
- Shrink only when necessary. If even the lowest useful quality is too large, the long edge is reduced by roughly 18% and the search runs again. This repeats until the target is met or the image becomes too small to be useful — at which point the tool says so instead of pretending.
Photo and signature limits on government forms
Portals in Pakistan, India, Bangladesh and elsewhere often publish narrow upload windows. Common ranges are a photograph of about 20–50 KB and a signature of about 10–20 KB; some exam and visa portals ask for 100 KB, 200 KB or a minimum size instead of a maximum. The form is the only authority. Read the exact wording — “between 20 KB and 50 KB” is not the same instruction as “not exceeding 50 KB”.
| Upload | Typical range | Practical starting point |
|---|---|---|
| Passport-style photo | 20–50 KB | 480 px long edge, JPG, target 20 KB |
| Signature | 10–20 KB | 320–400 px long edge, JPG, plain white background |
| Scanned document page | 100–500 KB | 1200–1600 px long edge, JPG |
| Website or email image | Under 100–200 KB | 1200 px long edge, JPG or WebP |
A 35 × 45 mm passport photo at 300 dpi is about 413 × 531 px; a 35 × 15 mm signature at the same resolution is about 413 × 177 px. Those pixel counts are a sensible upper bound for a form that only needs a small print or an on-screen check. Uploading a 12-megapixel original and compressing it to 20 KB wastes quality on pixels the form will never use.
Preparing a photo that compresses well
- Crop to the required framing. A head-and-shoulders crop spends the available bytes on the face instead of the background.
- Use even, plain light. Harsh shadows and a busy wall both cost bytes. A plain light background is the single biggest improvement for a small file.
- Do not upscale. A 200 px image enlarged to 480 px adds soft pixels, not detail, and compresses badly. Start from the largest original you have.
- Keep the face sharp. Most forms check that the face is visible; heavy compression that smears the eyes is a common reason for rejection.
For a signature, the best source is a clean scan or a photo taken straight-on in good light, then cropped tightly. Convert it to greyscale if the form allows it: colour information is a large part of the file and adds nothing to a pen stroke. A pure black stroke on pure white compresses far better than a greyish photo of paper.
JPG, PNG and WebP
| Format | How it stores an image | Best for | Limitations |
|---|---|---|---|
| JPG | Lossy; discards detail in a way tuned for photographs | Photos, scans, almost every upload form | No transparency; each save loses a little more |
| PNG | Lossless; every pixel is kept exactly | Logos, screenshots, text, transparency | Very large for photographs; no quality setting |
| WebP | Lossy or lossless, with a better ratio than JPG at small sizes | Websites, small images that need transparency | Not accepted by every portal or older app |
Converting a JPG to PNG does not restore the detail the JPG already discarded; it only stops further loss and usually multiplies the file size. Converting a PNG with transparency to JPG requires filling the transparent area with a colour — white by default. That is fine for a signature on paper, wrong for a logo that needs to sit on a coloured background.
“Quality” is not a universal number. A JPG saved at 80% by one encoder can differ from 80% in another program, because each library maps the value to its own tables. Compare the file size and the visible result, not the label.
Compressing versus converting
Use the compressor when the requirement is a number: “under 20 KB”, “between 10 and 20 KB”, “below 100 KB”. It can also resize while it works, and it reports whether the target was actually reached.
Use the converter when the requirement is a format or an orientation: “upload a PNG”, “JPG only”, “rotate this scan”, “make it 800 px wide”. It keeps the full quality of the source and applies one clean resize, rotation or flip. If you need both, convert first, then compress — that avoids encoding the same image twice at two different sizes.
Privacy: what the browser can do on its own
Both tools decode the file with the browser's image API and redraw it on a canvas. The re-encoded file is built from pixels only. EXIF camera data, GPS coordinates, the original thumbnail and most editing metadata are not copied into the new file. There is no upload step and no server that could keep a copy.
That privacy has a cost: if a form asks for the date the photo was taken, or an agency checks embedded camera information, the compressed copy will not contain it. Keep the original file. And because a wide-gamut colour profile may be dropped, extremely saturated colours can shift slightly.
A checklist before you upload
- Read the form's exact limits: maximum size, minimum size, format, and pixel dimensions if given.
- Crop to the required framing and use a plain background.
- Set the long edge to a sensible size — 480 px for a photo, 320–400 px for a signature.
- Choose JPG unless the form asks for PNG or WebP.
- Compress, then check the reported size and dimensions, not just the preview.
- Open the downloaded file once to confirm it is upright and readable.
- If the target was not reached, lower the long edge or switch to WebP — do not keep lowering quality alone.
Common problems
- The target was reached but the face is smeared. The source was probably small or noisy. Use a larger, sharper original with a plain background, and allow a larger long edge.
- The form rejects WebP. Many portals only accept JPG. Convert to JPG and check the size again; it may grow.
- The photo appears sideways. The camera stored an orientation tag. The compressor applies it; if another program ignores it, open the file in the converter and rotate explicitly.
- An iPhone HEIC file will not open. Most browsers cannot decode HEIC. Set the camera to Most Compatible, or share the photo as JPG first.
- The signature has a grey box around it. The scan included paper texture. Increase contrast, crop tighter, or convert to greyscale before compressing.
- The file is smaller than the minimum. Some forms also set a lower bound. Raise the quality or the long edge until the file is inside the window.
Compress a photo or signature in the image compressor, or change format and orientation in the image converter. Both run entirely in your browser.