Every image file is compressed in some way, so it takes less space on cards, drives and the internet. Done well, compression is invisible. Done badly, it leaves blocky patches, smeared detail and banded skies. This lesson explains how compression works, the difference between lossy and lossless compression, what JPEG quality settings really change, and how to protect your images from repeated compression.
What is image compression?
Image compression is a way of storing the information in an image using less data. There are two very different kinds:
| Lossless compression | Lossy compression | |
|---|---|---|
| How it works | Finds patterns and stores them more efficiently, like packing a suitcase neatly | Throws away detail the eye is least likely to notice |
| Quality | Identical to the original when opened | Some information is permanently lost |
| File size | Moderately smaller | Much smaller |
| Examples | Lossless RAW, TIFF (LZW or ZIP), PNG, DNG | JPEG, HEIF, most web images, lossy RAW options |
File formats themselves were compared in RAW versus JPEG and other image formats. This lesson looks at the compression inside them.
How JPEG compression works, simply
JPEG divides the image into small blocks and simplifies the fine detail and color changes inside each block, keeping the information our eyes notice most, such as overall brightness, and discarding finer variations. The more it simplifies, the smaller the file and the more detail is lost.
JPEG quality settings, often a scale such as 0–100 or 1–12, control how much is discarded. At high quality, the loss is very hard to see. At low quality, problems become obvious.
Compression artifacts
| Artifact | What it looks like | Where it appears |
|---|---|---|
| Blocking | Visible square blocks | Smooth areas and shadows |
| Banding | Steps in smooth gradients | Skies, studio backgrounds; see bit depth and digital tonality |
| Ringing (mosquito noise) | Faint halos or speckles around sharp edges | Text, branches against sky |
| Smearing | Fine textures turn soft and plastic | Grass, hair, skin, fabric |
| Color blotches | Patchy color | Subtle color areas |
Noise makes compression harder: random grain contains a lot of detail, so noisy images either produce bigger files or show more artifacts. This is one reason careful noise reduction before export helps.
Generation loss
Each time a JPEG is opened, edited and saved again as a JPEG, it is compressed again and loses a little more. After many saves, artifacts build up. This is called generation loss.
- Keep a master in RAW or a lossless format such as TIFF.
- Edit non-destructively so the original is never overwritten, as in non-destructive editing principles.
- Export a new JPEG from the master each time you need one.
Choosing JPEG quality
| Use | Typical quality | Why |
|---|---|---|
| Camera JPEG | Highest (often called Fine) | You cannot get discarded detail back |
| Prints and client delivery | High (around 90–100 on a 0–100 scale) | Best quality; size is less important |
| Websites and social media | Medium to high (around 70–85) | Good balance of quality and fast loading |
Remember:Quality numbers are not standard between programs, so a "90" in one may not equal "90" in another. Check the result at 100% and at normal viewing size.
Websites and social platforms usually recompress your images. Uploading at their recommended size and a good quality reduces the damage. Web compression and performance are covered in image compression and web performance.
Compression in RAW files
Cameras often offer RAW compression options: uncompressed, lossless compressed, and sometimes lossy compressed or high-efficiency RAW. Lossless compressed RAW saves space with no quality loss, so many photographers choose it. Lossy RAW options save more space with very small losses that are usually invisible, but may show in extreme edits. Check your camera manual for what each option means.
Common mistakes
- Low-quality camera JPEGs to save space: the lost detail can never return.
- Editing and re-saving JPEGs repeatedly: generation loss.
- Exporting tiny, heavily compressed files for clients: blocky prints and screens.
- Uploading huge files to platforms: they compress them heavily anyway; upload at recommended sizes.
How professionals handle compression
Professionals keep lossless masters, usually RAW files with non-destructive edits or 16-bit TIFFs, and export JPEGs at quality levels suited to each use. Many use lossless compressed RAW to save card and drive space without quality loss. They create export presets for web, social and print so compression is consistent, and they check exported files at the size viewers will see them.
Practical examples
A blocky sunset
- Situation
- A sunset photo posted online shows blocky patches in the sky.
- What to do
- You re-export from the RAW at the platform's recommended size with high quality and a touch of noise reduction.
- Why it works
- Your earlier file was small and heavily compressed, and the platform compressed it again.
- Result
- A smoother sky after upload.
A logo edited many times
- Situation
- A client's product photo has been edited and re-saved as JPEG many times and now looks smeared.
- What to do
- You return to the original RAW, redo the edits non-destructively and export one fresh JPEG.
- Why it works
- Each JPEG save added generation loss.
- Result
- A clean, detailed image.
Key points
- Lossless compression keeps all information; lossy compression discards detail for smaller files.
- JPEG quality settings control how much is discarded; artifacts appear at low quality.
- Common artifacts: blocking, banding, ringing, smearing and color blotches.
- Repeated JPEG saving causes generation loss; keep lossless masters.
- Lossless compressed RAW saves space without quality loss.
Frequently asked questions
What is the difference between lossy and lossless compression?
What JPEG quality should I use?
Does saving a JPEG reduce quality?
Is compressed RAW worse than uncompressed RAW?
Conclusion
Compression makes files manageable. Lossless compression is free of quality loss; lossy compression trades detail for size. Keep lossless masters, choose JPEG quality for each use, avoid repeated JPEG saves and use lossless compressed RAW when available. Next, you will learn how lenses and sensors work together to create sharp images.
Finished reading? Track your progress through Sensors and RAW.