Get Most Common Image Colors (Soze)
Pull a palette out of any image
- input_image
- rgb_colors
- hex_colors
- status
Sometimes you don't want to transform an image inside ComfyUI, you want to ask it a question - what colors dominate this thing? That's what Get Most Common Image Colors is for: feed it an image, and it hands back a ranked list of dominant colors as both RGB and hex strings. Useful for palette-matching a background to a generated subject, driving a color-aware overlay or text-color decision downstream, or just inspecting what a checkpoint actually produced without eyeballing it.
How it works
It analyzes the pixels of input_image and buckets them down to the num_colors most common ones, skipping anything you've listed in exclude_colors (pure black and pure white by default - sensible excludes since generated images often have flat black/white regions from padding, letterboxing, or masks that would otherwise dominate the result without being visually meaningful). The output gives you the winning colors as both RGB tuples and hex codes, so whichever format the next node in your graph wants, you've got it without a conversion step.
The inputs and outputs that matter
input_image- required, IMAGE. What you're analyzing.num_colors- optional, default5, range 1–128. "Number of colors to detect," per the node's own tooltip. Five is a reasonable starting point for a simple palette; push it higher if you want a finer-grained breakdown of a busy or gradient-heavy image.exclude_colors- optional, default#000000,#FFFFFF. "Comma-separated list of colors to exclude from the output," per its tooltip. Add more hex codes here (comma-separated) if your images have another flat, non-meaningful color you want filtered out - a specific background color from a green-screen render, for instance.- Output:
rgb_colors- the detected palette as RGB. - Output:
hex_colors- the same palette as hex strings, ready to drop into anything that expects a CSS-style color code. - Output:
status- a status string for the run; wire it to a text display if you want visibility into whether the analysis completed cleanly.
How to install it
Via ComfyUI Manager: search "Quality of Life Nodes for ComfyUI" or "Soze." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt
then restart. This node does real image processing (not just plumbing), so make sure pip install -r requirements.txt actually completed - if it's silently skipped, this is one of the nodes in the pack most likely to fail on a missing dependency rather than just not appear.
Common issues & troubleshooting
The palette is dominated by one or two colors you didn't expect. Check exclude_colors first - if your image has large flat regions (a solid background, letterboxing, an alpha-flattened area) that aren't black or white, add their hex codes to the exclude list, since the defaults only strip pure black and pure white.
Results look off for a very busy or high-detail image. Dominant-color extraction on a photorealistic or texture-heavy image will always skew toward whatever hue occupies the most pixels, not what looks visually important to a human eye - that's inherent to any pixel-count-based color extraction, not specific to this node.
Node fails to load or errors on run. Since this one does actual image analysis rather than pure string/number plumbing, re-run pip install -r ComfyUI_Soze/requirements.txt and check the console for a missing-package error before assuming the workflow itself is wrong.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_image | IMAGE | — | |
| num_colorsopt | INT | 51–128 | Number of colors to detect |
| exclude_colorsopt | STRING | #000000,#FFFFFF | Comma-separated list of colors to exclude from the output |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| rgb_colors | STRING | — |
| hex_colors | STRING | — |
| status | STRING | — |