Lably
Skip to content

Image compression

Reduction of image size to save storage and transmission costs

  • 5 min read
  • 4 chapters

Related on Lably

Through Data communication, Algorithm and Visual perception

Lossy and lossless image compression

Image compression may be lossy or lossless. Lossless compression is preferred for archival purposes and often for medical imaging, technical drawings, clip art, or comics. Lossy compression methods, especially when used at low bit rates, introduce compression artifacts. Lossy methods are especially suitable for natural images such as photographs in applications where minor (sometimes imperceptible) loss of fidelity is acceptable to achieve a substantial reduction in bit rate. Lossy compression that produces negligible differences may be called visually lossless.

Methods for lossy compression:

  • Transform coding – This is the most commonly used method.
    • Discrete Cosine Transform (DCT) – The most widely used form of lossy compression. It is a type of Fourier-related transform, and was originally developed by Nasir Ahmed, T. Natarajan and K. R. Rao in 1974. The DCT is sometimes referred to as "DCT-II" in the context of a family of discrete cosine transforms (see discrete cosine transform). It is generally the most efficient form of image compression.
      • DCT is used in JPEG, the most popular lossy format, and the more recent HEIF.
    • The more recently developed wavelet transform is also used extensively, followed by quantization and entropy coding.
  • Color quantization - Reducing the color space to a few "representative" colors in the image. The selected colors are specified in the color palette in the header of the compressed image. Each pixel just references the index of a color in the color palette. This method can be combined with dithering to avoid posterization.
    • Whole-image palette, typically 256 colors, used in GIF and PNG file formats.
    • block palette, typically 2 or 4 colors for each block of 4x4 pixels, used in BTC, CCC, S2TC, and S3TC.
  • Chroma subsampling. This takes advantage of the fact that the human eye perceives spatial changes of brightness more sharply than those of color, by averaging or dropping some of the chrominance information in the image.
  • Fractal compression.
  • More recently, methods based on Machine Learning were applied, using Multilayer perceptrons, Convolutional neural networks, Generative adversarial networks and Diffusion models. Implementations are available in OpenCV, TensorFlow, MATLAB's Image Processing Toolbox (IPT), and the High-Fidelity Generative Image Compression (HiFiC) open source project.

Methods for lossless compression:

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication