Technical Deep Dive

How to Reduce File Size While Preserving Useful Quality

Published June 10, 2026 • 7 min read

Have you ever tried to upload a passport photo to a government application portal, only to be rejected because your file is 2.5MB and the limit is 100KB? You aren't alone. As smartphones cameras become more advanced, the photos they take become massively larger. A standard iPhone photo can easily exceed 4MB.

In this technical deep dive, we'll explain exactly how file compression works, the difference between lossy and lossless algorithms, and how to shrink your files by 90% without making them look like a blurry mess.

The Two Types of Compression

When you use an image compressor, the software uses complex mathematical algorithms to reduce the amount of data required to represent the image. This falls into two categories:

1. Lossless Compression

Lossless compression works by finding repetitive data in a file and rewriting it more efficiently. For example, if an image has a solid blue sky with 1,000 blue pixels in a row, the algorithm can record "1,000 blue pixels" instead of recording the color value 1,000 separate times.

The result: The file size is reduced (usually by 10-20%), but the image is mathematically identical to the original. Formats like PNG support lossless compression. This is ideal for text documents or graphics with solid colors, but it rarely reduces photo sizes enough to pass a 100KB portal limit.

2. Lossy Compression

Lossy compression permanently removes data from the file that the human eye is unlikely to notice. It groups similar colors together and throws away the subtle gradients.

The result: The file size drops dramatically (up to 95%), but some visual information is gone forever. If you compress it too much, you will start to see "artifacts"—blocky, pixelated areas. Formats like JPEG and WebP use lossy compression.

The WebP Revolution

JPEG remains widely accepted for photographs. WebP can often produce a smaller file at similar visual quality, but many application portals still accept only JPG or PNG.

Choose the format listed by the official form. A smaller WebP file is not useful if the upload field rejects WebP.

The "Resize + Compress" Strategy

If you have a 4MB photo and need it under 50KB, compression alone will not work. You must combine it with resizing.

  1. Resize the dimensions: A modern phone photo may be several thousand pixels wide. If the form requests smaller dimensions, resizing first removes data that the portal does not need.
  2. Apply Lossy Compression: Once the image is 600x600, you apply a medium JPEG or WebP compression (around 80% quality).

This combined approach is how the QuickFormTools Photo Compressor works. It uses the browser's Canvas API to scale the dimensions, then exports the result as a JPEG or WebP at an adjusted quality setting. The tool aims to stay under the requested limit, but the exact result depends on the image and chosen dimensions.

Conclusion

Hitting a strict file-size limit does not always require a heavily degraded photo. Understanding the relationship between dimensions, format and compression quality makes it easier to prepare a file while preserving enough detail for its intended use.

About the Author: Ankit Lahre

Ankit builds and edits QuickFormTools. This article explains the resizing and browser export choices used by the site's photo tools.