Downsampling
The process of reducing image resolution by decreasing pixel count while applying appropriate filtering to prevent aliasing and maintain visual quality.
Downsampling reduces the pixel count of an image. Shrinking a 4000x3000 photo to 800x600 consolidates 20 million pixels into 480,000. Naively discarding pixels introduces aliasing (jagged edges, moire), making proper low-pass filtering essential.
- Average pooling: Computes the mean of all pixels within each output region. Also used in CNN pooling layers for spatial reduction
- Gaussian filter + decimation: Removes frequencies above the Nyquist limit via Gaussian blur before subsampling. OpenCV's
cv2.pyrDown()implements this for image pyramids - Lanczos filter: High-quality windowed sinc filter. Modern browsers use similar filters internally for image scaling
- Area interpolation: OpenCV's
cv2.INTER_AREA, producing the most natural results for reduction operations
Downsampling appears in responsive image generation, ML input normalization, mipmap generation, and thumbnail creation. ImageMagick (convert -resize 50%) and Sharp (sharp(input).resize(400, 300)) provide convenient interfaces.
The key consideration is balancing visual quality against file size, selecting appropriate filters and target resolution for each use case.