JPEG chroma subsampling is what makes most JPEG files far smaller than the original image data. It reduces the detail of colour information while keeping full brightness detail. The three patterns you will see are 4:4:4 (no reduction), 4:2:2 (half the horizontal colour detail), and 4:2:0 (half both horizontally and vertically). Pick the right one and your images stay sharp at a fraction of the size. Pick the wrong one and red text turns to mush.
What Chroma Subsampling Does to an Image
JPEG converts an image from RGB to YCbCr, a colour space that splits brightness (luma, Y) from colour (chroma, Cb and Cr). Your eye is far less sensitive to fine colour detail than to brightness detail. Subsampling exploits that. Instead of storing a Cb and Cr value for every pixel, the encoder stores them for groups of pixels. The chroma channels are upsampled back to full size when the image is decoded.
The Three Subsampling Patterns
- 4:4:4. Every pixel gets its own Cb and Cr values. No colour detail is lost.
- 4:2:2. Chroma is sampled at half the horizontal resolution. Each chroma sample covers two pixels side by side.
- 4:2:0. Chroma is sampled at half horizontal and half vertical resolution. Each chroma sample covers a 2x2 block of pixels. This stores each chroma channel at one quarter of the pixel count, a large saving in colour data.
Because the luma channel keeps full resolution, the overall image still looks sharp in brightness. Colour detail, however, is smoothed out.
How Subsampling Saves Bytes
In a 4:4:4 image, the two chroma channels together demand as much data as the luma channel, ignoring compression. Switch to 4:2:0 and chroma data drops to one quarter of its original size. The total file size reduction depends on the image content, but the saving in colour data alone is substantial.
For photographs with natural scenes, soft gradients, and continuous tones, encode at 4:2:0. The file comes out noticeably smaller than 4:4:4 with no visible difference. Your eye is poor at detecting fine colour changes in such images, so the subsampling is invisible.
When Subsampling Visibly Hurts Quality
Subsampling fails on sharp, saturated edges. Red text and thin coloured lines suffer most. Chroma is averaged over a 2x2 block, so a single pixel of bright red on a white background gets its colour smeared into neighbouring pixels. The text turns fuzzy. Fine details like thin coloured lines become faint or vanish.
Content That Demands 4:4:4
- Red or blue text on a white background
- Colourful icons and logos with fine edges
- Graphs and charts with thin coloured lines
- Computer screenshots with UI elements
For these images, set subsampling to 4:4:4. That keeps edges crisp and colours accurate.
Controlling Subsampling in Common Tools
Different software exposes the subsampling setting in different places. Here is how to find it in two common tools.
Set Subsampling with cjpeg
libjpeg's cjpeg command line tool uses the -sample option. The syntax is -sample HxV for each component: luma, Cb, Cr.
- Open a terminal.
- For 4:4:4 output, run: cjpeg -sample 1x1 input.ppm > output.jpg
- For 4:2:0 output, run: cjpeg -sample 2x2 input.ppm > output.jpg
- For 4:2:2, use -sample 2x1.
Find the Setting in GIMP
GIMP hides subsampling under advanced options in its JPEG export dialogue. When you export a JPEG, expand the Advanced section and locate the subsampling dropdown. Choose 4:4:4 for the largest file and best quality, or 4:2:0 for the smallest file.
When to Use Each Subsampling Mode
Match the mode to your image type.
- Photos and natural images. Use 4:2:0. Photos look the same at 4:2:0 as they do at 4:4:4, and files are smaller.
- Screenshots and graphics. Use 4:4:4. This preserves sharp coloured edges, text, icons, and UI elements.
- Mixed content with a photo and text overlay. If the text is large and not highly saturated, 4:2:0 works. For small or red text, switch to 4:4:4.
Not sure? Encode a test image at both settings and compare the output at full zoom.
Subsampling and the YCbCr Colour Space
The YCbCr colour space separates an image into one luma channel (Y) and two chroma channels (Cb and Cr). Luma carries the brightness information that defines edges and texture. Chroma carries hue and saturation. Your visual system has lower spatial acuity for colour, so the chroma channels can be stored at reduced detail without a perceived loss in quality.
When subsampling is applied, the chroma channels are downsized before compression and upsampled after decompression. The luma channel stays at full resolution. Brightness edges remain sharp. Colour blur appears only where the original image had high-contrast colour changes.
Practical Tips for Avoiding Subsampling Artifacts
If your output shows blurry red text, fix it.
- Set subsampling to 4:4:4 for any image with small coloured text or thin coloured lines.
- Check your screen capture tool's JPEG settings. Many default to 4:2:0.
- When processing batches, use a tool that lets you set subsampling explicitly, such as cjpeg -sample 1x1.
- For web use, serve graphics as PNG if JPEG compression is not required.
Tools like jpegoptim.com help you optimise JPEG files while preserving your chosen subsampling setting.