Every digital image is a grid of pixels, and every pixel stores color information. A 12-megapixel photo from your phone contains 12 million pixels, each storing red, green, and blue values. Without compression, that single photo would be 36 megabytes.
Image compression reduces file size by finding and eliminating redundancy in this pixel data. The challenge is doing so without making the image look noticeably worse. Here is how it works and how to get the best results.
How Compression Actually Works
Lossless Compression
Lossless compression finds patterns in the image data and encodes them more efficiently — like replacing “blue blue blue blue blue” with “blue ×5.” The original data can be perfectly reconstructed.
Formats: PNG, TIFF (LZW), WebP (lossless mode)
Size reduction: Typically 20-50% smaller than raw data, depending on image content. Images with large areas of uniform color compress much better than complex photographs.
Lossy Compression
Lossy compression reduces file size by permanently removing data that is less perceptible to human vision. Human eyes are more sensitive to brightness differences than color differences — lossy algorithms exploit this by reducing color precision in ways that are nearly invisible.
Formats: JPEG, WebP (lossy mode)
Size reduction: Can achieve 80-95% smaller files compared to uncompressed originals, with the trade-off that some detail is permanently lost.
Understanding JPEG Quality Settings
When you save a JPEG, the “quality” slider (typically 1-100) controls how aggressively the compression algorithm removes data:
- Quality 100: Maximum quality, minimal compression. Files are large but virtually identical to the original. Rarely necessary.
- Quality 85-90: Excellent quality. The sweet spot for most uses — significant size reduction with no visible quality loss to the naked eye.
- Quality 70-80: Good quality. Slight quality loss becomes visible on very close inspection. Ideal for web images where speed matters.
- Quality 50-60: Noticeable compression artifacts. Acceptable for thumbnails and preview images.
- Quality below 30: Heavy artifacts, blocky edges, and color banding. Only suitable for extreme bandwidth constraints.
Compression Artifacts: What Goes Wrong
When compression is too aggressive, you will see these telltale signs:
- Blocking: The image appears divided into visible 8×8 pixel blocks, especially in smooth gradient areas
- Ringing: Bright halos around high-contrast edges (e.g., dark text on a light background)
- Color banding: Smooth gradients display as stepped bands of distinct colors instead of a smooth transition
- Mosquito noise: Shimmering, noisy pixels around sharp edges
These artifacts are permanent in lossy formats — once they appear in a saved file, they cannot be removed.
Compression for Specific Use Cases
Email Attachments
Most email providers limit attachment sizes to 10-25 MB. For sharing multiple photos:
- Resize to 1600px on the longest side
- Use JPEG quality 82
- Target: 200-400 KB per image
Social Media
Platforms like Instagram, Facebook, and Twitter recompress all uploaded images to their own specifications. There is no benefit to uploading enormous files.
- Resize to platform dimensions (e.g., 1080×1080 for Instagram)
- Use JPEG quality 85 or WebP quality 85
- Target: 150-300 KB per image
Website Performance
Google recommends that no single image exceeds 200 KB for optimal Core Web Vitals scores.
- Resize to display dimensions ×2 for retina
- Use WebP for modern browser support with JPEG fallback
- Target: 50-200 KB depending on image importance
Document Submissions
Government forms, job applications, and exam portals often require images under specific sizes (50 KB, 100 KB, 200 KB):
- Use a target-size compressor to hit the exact requirement
- Start at maximum quality and reduce until the target is met
- Verify text is still readable after compression
Batch Compression
When you have dozens or hundreds of images to compress, processing them individually is impractical. Batch compression tools apply the same settings to all images simultaneously, which is essential for:
- E-commerce product catalogs
- Photography portfolios
- Content management systems
- Website migrations
The Compression Workflow
- Start with the highest quality source — never compress an already-compressed image
- Resize first — this has the biggest impact on file size
- Choose the right format — JPEG for photos, PNG for graphics, WebP for web
- Set appropriate quality — 80-85 for web, 90+ for archives
- Compare result to original — look for artifacts at full zoom
- Verify file size meets your target — adjust quality if needed