C09 lesson 10 of 12 5 min read Intermediate

Image Compression and File Quality

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.

The question this lesson answersHow does compression make files smaller, and when does it harm image quality?

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 compared with lossy compression
Lossless compressionLossy compression
How it worksFinds patterns and stores them more efficiently, like packing a suitcase neatlyThrows away detail the eye is least likely to notice
QualityIdentical to the original when openedSome information is permanently lost
File sizeModerately smallerMuch smaller
ExamplesLossless RAW, TIFF (LZW or ZIP), PNG, DNGJPEG, 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

Common compression artifacts
ArtifactWhat it looks likeWhere it appears
BlockingVisible square blocksSmooth areas and shadows
BandingSteps in smooth gradientsSkies, studio backgrounds; see bit depth and digital tonality
Ringing (mosquito noise)Faint halos or speckles around sharp edgesText, branches against sky
SmearingFine textures turn soft and plasticGrass, hair, skin, fabric
Color blotchesPatchy colorSubtle 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

Practical JPEG quality choices
UseTypical qualityWhy
Camera JPEGHighest (often called Fine)You cannot get discarded detail back
Prints and client deliveryHigh (around 90–100 on a 0–100 scale)Best quality; size is less important
Websites and social mediaMedium 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?
Lossless compression keeps all information; lossy compression permanently discards some detail to make smaller files.
What JPEG quality should I use?
Highest in camera, high (about 90–100) for prints and clients, and medium to high (about 70–85) for web.
Does saving a JPEG reduce quality?
Yes. Each new save as JPEG compresses it again, slowly reducing quality.
Is compressed RAW worse than uncompressed RAW?
Lossless compressed RAW has no quality loss. Lossy RAW options lose a very small amount, usually invisible.

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.

Related lessons

0 views