Nodes/ComfyUI-enricos-nodes/πŸ’œ Image Color Sampler
ComfyUI Node

πŸ’œ Image Color Sampler

Click on an image, walk away with a palette and every color format you need

By erosDiffusionΒ·Created 2 years agoΒ·Updated about a month agoΒ· 634
πŸ’œ Image Color Sampler
  • image
  • palette
  • sampled_colors
  • hex_codes
  • swatches
  • rgb_24bit
  • rgb_565
  • rgb_values
β—„sample_points[]β–Ί
β—„palette_size128β–Ί
β—„sample_size1β–Ί
β—„wait_for_inputtrueβ–Ί

This is the sampler half of the pack's color story: feed it any image, and instead of typing color values by hand you click directly on the picture to pick colors, then get the whole set back as a palette strip, per-color swatches, and in every number format ComfyUI's other nodes want. It's the natural partner to the Compositor Color Picker - that node converts one RGB you type in, this one harvests a palette from an image you point at.

It's an interactive node, which means it behaves differently from most: when you run it with wait_for_input on, it blocks execution and pops the image up in the UI for you to click. You place sample points, hit continue, and the flow resumes with the colors baked in. No inference happening here - it's picking pixels, optionally averaging a small area around each click.

Inputs

  • image - any IMAGE. The whole thing is fair game for sampling.
  • sample_points - the JSON list of click coordinates, auto-filled as you click. Multi-line string, managed by the UI; you shouldn't hand-edit it.
  • palette_size - the height in pixels of the output palette/swatch images (128 default, 32–512).
  • sample_size - the radius of the averaging window around each click (1–30, default 1). At 1 it grabs the exact pixel color; bump it to average a small area, which smooths out noise in gradients and photos.
  • wait_for_input - on (default) means the node blocks until you've clicked and continued. Off makes it skip the interactive step and just process whatever's in sample_points.

Outputs

  • palette - one IMAGE, a horizontal strip of your sampled colors. Feed it anywhere an image of the palette helps.
  • sampled_colors - JSON with each point's position and color.
  • hex_codes (list) - one hex string per sample, for prompt or text nodes.
  • swatches (list) - a separate solid-color IMAGE per sample.
  • rgb_24bit (list) - the packed 24-bit integers ComfyUI's Empty Image accepts.
  • rgb_565 (list) - packed 16-bit RGB565 values.
  • rgb_values (list) - formatted (r, g, b) strings.

Note several outputs are lists, so they can fan out to multiple consumers. Also, the node is an output node, so its UI can surface the sampled colors directly.

Installing

Same pack, no models, no extra deps:

cd ComfyUI/custom_nodes
git clone https://github.com/erosDiffusion/ComfyUI-enricos-nodes.git

or ComfyUI Manager β†’ "Compositor" β†’ erosDiffusion, restart.

Gotchas

The interactive flow can confuse at first: run the workflow, the node blocks and shows your image, you click samples, click continue, and it re-queues itself with the points saved to the sample_points widget. If you're in a headless/API setup there's no one to click, so either pre-fill sample_points as JSON or turn wait_for_input off. And remember sample_size 1 means exact pixel color - if your palette looks noisy, raise it to 3–5 rather than blaming the image.

Categoryimage/color

Inputs (5)

NameTypeDefaultDescription
imageIMAGEβ€”
sample_pointsSTRING[]β€”
palette_sizeINT12832–512β€”
sample_sizeINT11–30β€”
wait_for_inputBOOLEANtrueβ€”

Outputs (7)

NameTypeDescription
paletteIMAGEβ€”
sampled_colorsSTRINGβ€”
hex_codesSTRINGβ€”
swatchesIMAGEβ€”
rgb_24bitINTβ€”
rgb_565INTβ€”
rgb_valuesSTRINGβ€”