How to Compress an Image: Methods, Formats, and What Actually Changes
Image compression is one of those tasks that sounds simple until you realize there are a dozen different ways to do it — and the "right" method depends entirely on what you're compressing, why, and where the image is going. Here's a clear breakdown of how compression works, what your options are, and what tradeoffs each approach involves.
What Image Compression Actually Does
When you compress an image, you're reducing the amount of data needed to store or transmit it. That data reduction happens in one of two fundamental ways:
Lossless compression removes redundant data without discarding any visual information. The image can be perfectly reconstructed from the compressed file. File size reductions are modest — typically 10–30% depending on the image content.
Lossy compression permanently discards visual data that the algorithm judges to be less noticeable to the human eye. File sizes can drop dramatically — sometimes 70–90% — but some image quality is gone for good.
Most everyday image compression involves lossy methods, which is why a JPEG saved at low quality looks noticeably degraded compared to the original.
Common Compression Methods by Format 🗜️
Different image formats handle compression differently, and choosing a format is often the first real decision:
| Format | Compression Type | Best Use Case |
|---|---|---|
| JPEG | Lossy | Photos, complex images |
| PNG | Lossless | Graphics, screenshots, transparency |
| WebP | Both available | Web images, modern browsers |
| AVIF | Both available | High-efficiency web delivery |
| GIF | Lossless (limited) | Simple animations, flat graphics |
| HEIC | Lossy | iPhone photos, Apple ecosystem |
Switching formats alone — for example, converting a PNG photo to a JPEG — can reduce file size significantly without using any dedicated compression tool.
Ways to Compress an Image
Built-In Operating System Tools
Windows includes basic compression options through Paint and Photos apps. Neither gives precise control over compression quality, but they're sufficient for casual resizing and export tasks.
macOS offers Preview, which lets you export images with adjustable quality sliders and format conversion. It's more capable than most users realize for basic compression tasks.
iOS and Android both apply compression automatically when you share photos through Messages or email. The degree of compression varies by app and settings — manually sharing via a cloud link often preserves more quality than sending inline.
Desktop Software
Applications like Adobe Photoshop, GIMP, and Affinity Photo give granular control over compression settings. When exporting a JPEG in Photoshop, for example, you can set a quality value from 0–100 and preview the output before saving. This level of control matters when you need consistent results across many images.
Dedicated tools like ImageOptim (macOS) or FileOptimizer (Windows) apply multiple compression algorithms in sequence and are particularly effective for batch processing without visible quality loss.
Browser-Based Tools
Online compressors — such as Squoosh, TinyPNG, or Compress JPEG — handle compression in-browser without requiring software installation. They're convenient for one-off tasks. Most offer format conversion, quality adjustment, and side-by-side previews.
The main variable with web-based tools is privacy: you're uploading your image to a third-party service. For personal or sensitive images, local tools are generally the better choice.
Command-Line Tools
Tools like ImageMagick, cjpeg, or libvips are used in development environments and server pipelines. They allow scripted, automated compression at scale — useful when processing hundreds or thousands of images consistently.
The Variables That Determine Your Results 📐
Image compression isn't one-size-fits-all. Several factors shape what's actually achievable:
Starting file quality: A raw or unedited original will compress better and retain more usable quality than an image that's already been saved and re-saved in lossy format multiple times. Each lossy save introduces more degradation.
Image content: Photos with continuous tones and gradients (landscapes, portraits) compress differently than flat graphics with sharp edges and text. PNG often outperforms JPEG on screenshots; JPEG typically outperforms PNG on photographs.
Target use case: Web images prioritize small file size and fast load times. Print images prioritize maximum detail. Archiving favors lossless formats. Each goal points toward different compression settings.
Acceptable quality threshold: "Good enough" is subjective and context-dependent. A compressed thumbnail on an e-commerce listing has a different quality bar than a product photo being printed on packaging.
Destination platform: Some platforms — Instagram, WhatsApp, Twitter/X — re-compress images on upload regardless of how you've already compressed them. Sending an already-compressed image through one of these can cause stacked quality losses.
Resizing vs. Compressing: Not the Same Thing
These terms are often confused. Resizing changes the pixel dimensions of an image. Compressing reduces file size within the same or similar dimensions. Both affect file size, but through different mechanisms.
Reducing an image from 4000×3000 pixels to 800×600 pixels will dramatically shrink the file — but that's a resolution change, not compression. Compression can then be applied on top of that. Many tools combine both steps, which is why results can vary unexpectedly between applications.
When Lossless Isn't Actually Lossless
One important nuance: lossless compression preserves the existing pixel data, but that data may already reflect prior lossy compression. A PNG created by screenshotting a JPEG displayed in a browser is lossless in format but contains JPEG artifacts from the original. The format label and the actual image quality aren't always aligned.
This matters for anyone archiving images or using them as source material for future editing. 🔍
What Determines the Right Approach for You
The technical mechanics of compression are consistent — but which method, format, quality setting, and tool produces the right result depends on a combination of where the image is going, what software you already have available, how much quality you can afford to lose, and how many images you're processing at once. Those variables don't have a universal answer — they're specific to what you're working with and what you're trying to accomplish.