Yotsuba Games
Back to Node List

Palette Quantize

palette_quantize

Quantizes an image to an input or extracted palette

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
็”ปๅƒ
input
Image
Required
ๆธ›่‰ฒใ—ใŸใ„็”ปๅƒใงใ™
ใƒ‘ใƒฌใƒƒใƒˆ
palette
Palette
ไปปๆ„ใฎใƒ‘ใƒฌใƒƒใƒˆๅ…ฅๅŠ›ใงใ™ใ€‚ๆœชๆŽฅ็ถšใชใ‚‰็”ปๅƒใ‹ใ‚‰ใƒ‘ใƒฌใƒƒใƒˆใ‚’ๆŠฝๅ‡บใ—ใพใ™

Output Ports

NameTypeDescription
็”ปๅƒ
output
Image
ๆธ›่‰ฒๅพŒใฎ็”ปๅƒใงใ™
ใƒ‘ใƒฌใƒƒใƒˆ
palette
Palette
ๆธ›่‰ฒใซไฝฟใฃใŸใƒ‘ใƒฌใƒƒใƒˆใงใ™

Parameters

NameTypeDefaultRangeDescription / Options
ๆŠฝๅ‡บใƒขใƒผใƒ‰
extract_mode
Enum
Representativeโ€”

ใƒ‘ใƒฌใƒƒใƒˆๅ…ฅๅŠ›ใŒใชใ„ๆ™‚ใซใ€็”ปๅƒใ‹ใ‚‰ใฉใ†ใƒ‘ใƒฌใƒƒใƒˆใ‚’ไฝœใ‚‹ใ‹ใงใ™

  • ๅฎŸ่‰ฒๆŠฝๅ‡บExact
    ็”ปๅƒใงๅฎŸ้š›ใซไฝฟใ‚ใ‚Œใฆใ„ใ‚‹่‰ฒใ‚’ใ€ใใฎใพใพ้ ปๅบฆ้ †ใงๆฎ‹ใ—ใพใ™ใ€‚
  • ไปฃ่กจ่‰ฒๆŠฝๅ‡บRepresentative
    ่ฟ‘ใ„่‰ฒใ‚’ใพใจใ‚ใฆไปฃ่กจ่‰ฒใซใ—ใ€ๆธ›่‰ฒๅ‘ใ‘ใฎใƒ‘ใƒฌใƒƒใƒˆใ‚’ไฝœใ‚Šใพใ™ใ€‚
ๆœ€ๅคง่‰ฒๆ•ฐ
max_colors
Int
161โ€“256

ๆŠฝๅ‡บๆ™‚ใซๆฎ‹ใ™ๆœ€ๅคง่‰ฒๆ•ฐใงใ™

้€ๆ˜Žใ‚‚ๅซใ‚ใ‚‹
include_transparent
Bool
falseโ€”

ใƒ‘ใƒฌใƒƒใƒˆๆŠฝๅ‡บๆ™‚ใซๅฎŒๅ…จ้€ๆ˜Žใƒ”ใ‚ฏใ‚ปใƒซใ‚‚ๅซใ‚ใพใ™

ๅ…ƒใฎ้€ๆ˜Žๅบฆใ‚’ไฟใค
preserve_alpha
Bool
trueโ€”

่‰ฒใ‚’ๅค‰ใˆใฆใ‚‚ใ€ๅ…ƒ็”ปๅƒใฎ้€ๆ˜Žๅบฆใฏใใฎใพใพๆฎ‹ใ—ใพใ™

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
Palette Quantize โ€” PixPipeline Node Reference