Studio Yotsuba
Back to Node List

Palette Quantize

palette_quantize

Quantizes an image to an input or extracted palette

Reviewed
Guide available

Input Ports

NameTypeDescription
Image
input
Image
Required
Image to quantize
Palette
palette
Palette
Optional palette. If omitted, a palette is extracted from the image

Output Ports

NameTypeDescription
Image
output
Image
Quantized image
Palette
palette
Palette
Palette used for quantization

Parameters

NameTypeDefaultRangeDescription / Options
Extract Mode
extract_mode
Enum
Representative—

How to derive a palette when no palette input is connected

  • ExactExact
    Keep the actual colors used in the image, sorted by frequency.
  • RepresentativeRepresentative
    Merge nearby colors and output representative colors, useful for palette reduction.
Max Colors
max_colors
Int
161–256

Maximum number of colors to keep

Include Transparent
include_transparent
Bool
false—

Include fully transparent pixels when extracting a palette

Preserve Alpha
preserve_alpha
Bool
true—

Keep the original alpha channel after quantization

Overview

Quantizes an image by replacing every pixel with the nearest color in a palette. It is the finishing step that reduces continuous-tone assets such as gradients and noise to a fixed color count for pixel art. Use dither for a patterned reduction; use this node for flat color regions.

Usage tips

  • Connecting the project palette is the standard setup. Asset colors stay consistent, and later palette-side replacement through palette_swap and similar nodes continues to work.
  • The standard position is at the end of the graph, immediately before export. Intermediate nodes such as blur and curves create new colors, so processing after quantizing increases the color count again.
  • With no palette connected, automatic Representative extraction is suited to quantizing. Exact is for collecting colors actually used by an image that already follows a palette.
  • The palette output exposes the palette actually used, so it can feed downstream palette_* nodes or reference output.

Common pitfalls

  • Subtle tonal detail disappears: nearby colors intentionally collapse to the same palette entry. Add intermediate colors to the palette or use dither for simulated intermediate tones.
  • Pixels map to unexpected colors: two extremely similar palette colors can make assignment unstable. Clean up the palette or separate luminance upstream with tone_curve.
  • Artifacts appear on transparent edges: replacement can expose the color of translucent pixels. Check preserve_alpha (ON by default), and if needed clean up edges upstream with anti_alias or another edge operation.

Notes

  • A connected palette takes priority.
  • Without one, a palette is created from the image according to extract_mode and max_colors.
  • You can use separate Palette Extract + Palette Quantize, or Palette Quantize alone.

Examples

  1. Quantize an image to 16 colors.
  2. Match an asset image to an existing palette.
  3. Align a source image to its palette before Palette Swap.

Related nodes

  • dither — quantize with a dither pattern using the same parameter family
  • palette_extract — extract only the palette as a separate operation
  • palette_swap — replace the entire palette after quantizing
  • gradient_map — recolor by a luminance → ramp rule rather than nearest-color search
Back to Node List