← Back to blog

Floyd-Steinberg Dithering Algorithm Guide

Discover how the Floyd-Steinberg error diffusion algorithm works, why its 7/16 weights produce natural-looking results, and where it's used in modern art tools.

Black and white dithered image showing Floyd-Steinberg error diffusion algorithm

In 1976, Robert Floyd and Louis Steinberg published a simple but revolutionary algorithm for color reduction. Forty years later, Floyd-Steinberg dithering remains one of the most popular image processing techniques, and it's still used in modern art tools, web compression, and retro gaming emulators.

The Genius of Error Diffusion

Here's the core idea: When you reduce a pixel to the nearest available color, you introduce an error - a difference between what the pixel should be and what you actually displayed. Instead of discarding that error, Floyd and Steinberg's insight was to spread it to neighboring pixels. Those pixels then account for the error when they're processed, creating a ripple effect of correction across the entire image.

The result? Images that look photorealistic despite severe color limitations, without the banding artifacts you get from simple color reduction.

The Weights: 7/16, 3/16, 5/16, 1/16

The specific numbers Floyd and Steinberg chose were based on empirical testing. When a pixel has an error, they distribute it to four neighboring pixels using these proportions:

The current pixel (X) distributes its error as follows: 7/16 goes to the pixel to the right, 3/16 goes to the bottom-left, 5/16 goes directly below, and 1/16 goes to the bottom-right.

The largest share (7/16) goes to the right pixel, because the algorithm processes left-to-right. The bottom-left, bottom, and bottom-right pixels get 3/16, 5/16, and 1/16 respectively. The weights sum to 1, so no error is lost - it all propagates through the image.

Why These Specific Numbers?

Floyd and Steinberg tested many different weight distributions and found that these proportions produced the most natural-looking results with minimal artifacts. The 5/16 weight for the pixel directly below is heavier because vertical adjacency is more perceptually important than horizontal or diagonal adjacency.

The Algorithm Step-by-Step

  1. Scan the image left-to-right, top-to-bottom
  2. For each pixel, find the nearest color in your target palette
  3. Calculate the error: true_color - palette_color
  4. Distribute that error to the right (x7/16), bottom-left (x3/16), bottom (x5/16), and bottom-right (x1/16)
  5. Move to the next pixel

Floyd-Steinberg in the Real World

This algorithm is the default choice for professional image dithering because it balances visual quality and computational cost. You'll see it in:

  • PNG optimization: Web designers use it to reduce color depth while maintaining quality
  • GIF creation: The classic animated GIF format often relies on Floyd-Steinberg
  • Retro game emulators: Many emulators use it to simulate the look of original low-color hardware
  • Art tools: Professional image editors include it as a standard filter

Ready to try it? Open GlitchArt Studio and experiment with this effect.

Try this effect in GlitchArt Studio 85+ effects, real-time preview, free to use
Open Editor