TLDR Web Dev · ARTICLES & TUTORIALS

HOW ARE IMAGES REALLY STORED?

cefboud.com42 min read

Summary from the TLDR Web Dev newsletter

This article explains how images are stored, starting with the fundamental concept that pixels are the smallest units of color. Grayscale images store one byte per pixel, while color images use RGB (or RGBA) triplets, which require three or four bytes per pixel. Image formats like GIF use palettes to reduce storage by indexing colors, while PNG employs Deflate compression after applying filters to minimize pixel differences before compression. JPEG achieves high compression ratios through chroma subsampling (reducing color information) and the Discrete Cosine Transform (DCT), which exploit the human eye's lower sensitivity to color detail.