Nodes/AegisFlow Utility Nodes/Flatten Colors-Vextra
ComfyUI Node

Flatten Colors-Vextra

Posterize to a palette in one click

By aegis72·Created 3 years ago·Updated 2 years ago· 39
Flatten Colors-Vextra
  • images
  • IMAGE
number_of_colors5

The Flatten Colors node (displayed as "Flatten Colors-Vextra") is a one-parameter posterizer: it collapses an image down to a fixed number of colors. Set how many, feed it images, get back a flat, quantized version. It's one of the pack's "Vextra" ports - nodes rescued from diontimmer's ComfyUI-Vextra-Nodes after the original pack developed import errors and the maintainer went quiet, included here with full credit.

How it works

Under the hood it's PIL's adaptive palette quantization: the image is converted to palette mode with Image.ADAPTIVE at your chosen color count, then converted back to RGB. That's the same trick that produces clean posterized looks - the algorithm picks the color set that best represents the image, so you get a deliberate, graphic style rather than a random reduction. It runs per-image in a batch, so a whole sequence gets the same treatment consistently.

Inputs and outputs

  • images (IMAGE, required) - the image or batch to flatten.
  • number_of_colors (INT, default 5, range 1–4000) - the target palette size. This is the only knob, and it's where the whole aesthetic lives.
  • Output: IMAGE.

When you'd use it

Stylization, mostly. Low color counts (3–8) give that bold, almost graphic-novel or screen-print look that can make a render feel designed rather than generated. It's also handy when you want to push an image toward flat-shading before feeding it somewhere that prefers simple regions - some style-transfer or recoloring pipelines behave better on already-flattened input. And if you just want to preview "what would this look like as a 5-color poster," this is the fastest way to ask.

Installing it

Standard for the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/aegis72/aegisflow_utility_nodes

Restart ComfyUI, or install "AegisFlow Utility Nodes" via ComfyUI Manager. No model downloads; it's pure PIL.

Where people get burned

The default of 5 colors is aggressive - most images become obviously blocky, and on faces it can look harsh fast. That's the point, but don't be surprised; if you want a gentler posterized feel, dial it toward 12–32 colors, which reads as "painterly" instead of "comic." Also note there's no dithering or transparency handling here - it's a straight quantization, so subtle gradients will band. For a soft, smooth stylization you'd pair this with something else; on its own it's a blunt but reliable tool.

CategoryAegisFlow/fx

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
number_of_colorsoptINT51–4000

Outputs (1)

NameTypeDescription
IMAGEIMAGE