Effects / Dither

Floyd-Steinberg

Floyd-Steinberg is the classic error diffusion dithering algorithm, widely used since 1976. It produces high-quality results by distributing quantization error to neighboring pixels in a specific pattern, creating the illusion of more colors with fewer.

dither-floyd-steinbergFree

Effect ID: dither-floyd-steinberg

Example Configuration

floyd-steinberg.json
{
  "effectId": "dither-floyd-steinberg",
  "dither": {
    "pattern": "floydSteinberg",
    "pixelation": 4,
    "paletteId": "monochrome",
    "colors": ["#000000", "#ffffff"],
    "brightness": 1,
    "contrast": 1,
    "threshold": 0.5
  }
}

Settings

PropertyTypeDefaultDescription
patternstring"floydSteinberg"Dither pattern algorithm
pixelationnumber4Point size (1-10)
paletteIdstring"monochrome"Color palette ID (monochrome, gameboy, cga, etc.)
colorsstring[]["#000", "#fff"]Color array (dark to light)
brightnessnumber1Brightness adjustment (0.5-2)
contrastnumber1Contrast adjustment (0.5-2)
thresholdnumber0.5Error diffusion strength (0-1)

How It Works

Floyd-Steinberg scans the image left-to-right, top-to-bottom. For each pixel:

  1. The pixel is quantized to the nearest available color in the palette
  2. The error (difference between original and quantized) is calculated
  3. The error is distributed to neighboring pixels using this pattern:
      X    7/16
3/16  5/16  1/16

Where X is the current pixel and the fractions show how much error goes to each neighbor.

Available Palettes

  • monochrome - Black and white only
  • gameboy - Classic Game Boy green shades
  • cga - CGA 4-color palette
  • ega - EGA 16-color palette
  • custom - Define your own palette colors

API Usage

render-request.json
POST /api/v1/render
{
  "state": {
    "canvas": {
      "aspectRatio": "16:9",
      "backgroundColor": "#1a1a1a"
    },
    "layers": [...],
    "selectedLayerId": null,
    "effect": {
      "effectId": "dither-floyd-steinberg",
      "enabled": true,
      "dither": {
        "pattern": "floydSteinberg",
        "pixelation": 4,
        "paletteId": "gameboy",
        "colors": ["#0f380f", "#306230", "#8bac0f", "#9bbc0f"],
        "brightness": 1,
        "contrast": 1,
        "threshold": 0.5
      }
    }
  },
  "format": "png",
  "width": 1920,
  "height": 1080
}

Tips

  • Start with 2 colors for classic 1-bit dithering
  • Increase contrast slightly for better definition
  • Game Boy palette creates nostalgic handheld gaming aesthetic
  • Compare with Atkinson for a more "open" look