How the JPEG format tricks your eyes to save file space
The JPEG image format reduces file size by exploiting a quirk of human biology. Human eyes are incredibly sensitive to changes in brightness, but far less sensitive to slight variations in color. JPEG compression algorithms discard a massive amount of color data while preserving the precise brightness details, shrinking files by up to 90 percent without noticeable loss in quality.
The Challenge of Storing Digital Images
In the early days of digital computing and digital photography, storing and transmitting full-color images posed a significant technological bottleneck. A standard raw digital photograph records color by assigning numerical values to the red, green, and blue components of every individual pixel. For an image measuring several megapixels, saving these raw color values requires substantial storage and massive bandwidth to transmit across networks.
To make digital images practical for personal computers, digital cameras, and the emerging World Wide Web, engineers needed an efficient method to reduce file sizes without making photos look visibly degraded. In 1992, the Joint Photographic Experts Group introduced the JPEG standard (formally ISO/IEC 10918-1 and ITU-T Recommendation T.81). Rather than treating every piece of digital data as equally vital, the standard relies on the physiological characteristics of human sight to decide which visual information can be discarded.
Separating Brightness from Color
The first key step in JPEG compression involves transforming the way colors are represented. Digital displays natively use RGB color space, where red, green, and blue light combine to create the entire spectrum. However, the human visual system does not perceive all visual information equally. Human eyes possess far greater spatial acuity for variations in brightness—known as luminance—than for variations in color tone and saturation, known as chrominance.
JPEG exploits this asymmetry by converting the image from the standard RGB color space into YCbCr. In this space, 'Y' represents luminance (brightness), while 'Cb' and 'Cr' represent blue-difference and red-difference chrominance. Once separated, the encoder can reduce the resolution of the color channels through a process called chroma subsampling. In common schemes like 4:2:0 subsampling, half of the color resolution horizontally and vertically is dropped. Because human vision relies primarily on luminance to perceive sharp edges and fine texture, the brain barely notices this loss in color detail.