JPEG Color Bleeding at Saturated Boundaries

Color bleeding along saturated boundaries in JPEG images is a distinct visual artifact where bold colors appear to spill over sharp edges into neighboring regions. This phenomenon is primarily caused by JPEG’s lossy compression pipeline, specifically the use of chroma subsampling, the mathematical transformation into the YCbCr color space, and aggressive Discrete Cosine Transform (DCT) quantization. Because human vision is far more sensitive to variations in brightness than in color, JPEG algorithms prioritize luminance data at the expense of chrominance detail, creating noticeable color smearing where highly saturated colors meet stark contrast.

YCbCr Color Conversion and Human Perception

Digital displays natively render images using the RGB (Red, Green, Blue) color model. To compress an image efficiently, JPEG converts RGB data into the YCbCr color space:

The human visual system contains vastly more rod cells (which detect luminance) than cone cells (which detect color). By isolating color from brightness, the compression algorithm can selectively discard fine color details without severely degrading perceived overall sharpness.

Chroma Subsampling: The Primary Cause

Once in the YCbCr space, the image undergoes chroma subsampling, a process that intentionally lowers the spatial resolution of the color channels while keeping the brightness channel intact.

Most standard JPEG implementations use 4:2:0 subsampling:

Along sharp, saturated boundaries—such as pure red text on a blue or white background—adjacent pixels possess dramatically different chrominance values. Because the subsampling process averages these disparate color values across a 2x2 grid, the exact point of transition between the colors is lost.

DCT Quantization and Ringing Artifacts

After subsampling, the image is divided into 8x8 pixel blocks and processed using the Discrete Cosine Transform (DCT). The DCT translates spatial pixel data into frequency components.

Sharp edges represent high spatial frequencies. During the subsequent quantization step, JPEG algorithms aggressively round off or completely eliminate high-frequency chrominance coefficients because they contribute little to basic image recognition.

When high-frequency data is discarded along sharp edges, a mathematical artifact known as the Gibbs phenomenon (or ringing) occurs. In chrominance channels, this introduces ripples and imprecise color distribution near the boundary, exacerbating the spread of color across edge lines.

Chroma Upsampling and Interpolation

When a JPEG is decoded and displayed, the software must reconstruct the missing color information to map it back to an RGB image. The subsampled chroma channels are upsampled using interpolation algorithms (such as bilinear or bicubic filtering).

Because the algorithm must guess the color values of missing pixels based on averaged, quantized data, it smoothly transitions between the colors rather than creating an instantaneous step. This smoothing appears to the human eye as an obvious chromatic halo or "bleed" extending beyond the sharp luminance edge.

How to Prevent Color Bleeding

To avoid color bleeding along saturated boundaries: