What is JPEG compression?
JPEG (Joint Photographic Experts Group) compression reduces file size by selectively discarding visual information that the human eye is less sensitive to. It's a lossy compression method — some data is permanently removed each time you save.
The magic lies in a mathematical technique called the Discrete Cosine Transform (DCT), which converts pixel data into frequency data. High-frequency detail (fine textures) can be discarded with minimal visual impact.
The compression pipeline
- Colour space conversion: RGB is converted to YCbCr (luminance + chrominance). The human eye is more sensitive to brightness than colour, so chrominance can be downsampled.
- Block division: The image is divided into 8×8 pixel blocks.
- DCT transform: Each block is converted from spatial domain to frequency domain.
- Quantisation: This is where compression happens. High-frequency coefficients are rounded or zeroed out based on the quality level.
- Encoding: The remaining data is compressed using Huffman coding.
Quality levels: What the numbers mean
| Quality | File size reduction | Visual impact | Best for |
|---|---|---|---|
| 95–100% | Minimal (2–3×) | Virtually identical to original | Professional photography |
| 80–90% | Moderate (5–10×) | Barely noticeable | Web images, documents |
| 60–75% | Significant (10–20×) | Visible on close inspection | Thumbnails, previews |
| Below 50% | Extreme (20–50×) | Obvious artefacts | Very small file size needs |
For passport and exam photos, 80–90% quality is the sweet spot — small enough for upload limits while maintaining clarity. Use PhotoResizer.in to compress to exact KB targets.
Re-compression: Why saving JPEG multiple times is bad
Each time you open, edit, and re-save a JPEG, it goes through the compression pipeline again. This is called generation loss. After 5–10 re-saves, visible artefacts accumulate, especially around high-contrast edges.
Best practice: Always edit from the original file, and only save the final output as JPEG. If you need to make multiple edits, work in PNG or TIFF until the final export.
