Nodes/ComfyUI S4Tool Image/💀Image Palette
ComfyUI Node

💀Image Palette

Five colors, sorted the way you want, as hex strings

By S4MUEL-404·Created about a year ago·Updated 10 months ago· 4
💀Image Palette
  • image
  • palette_image
  • color1
  • color2
  • color3
  • color4
  • color5
algorithmK-Means Clustering
sort_modeHue

The full color story of an image, in five colors, ordered the way you want them, as usable hex strings. That's 💀Image Palette from the S4Tool-Image pack - the biggest of the pack's color-extraction nodes and the one you reach for when you need a working palette, not just a dominant color. It shares an engine with 💀Image Primary Color and 💀Image Palette 6-3-1, but adds the two things those lack: five colors and a real sort mode.

The mechanism is the pack's shared extraction engine with a sorting step bolted on. The image is downsampled, five representative colors are pulled using your chosen algorithm, then sorted by hue, saturation, or brightness. The sorted order is what makes the output predictable: sort by hue and you get a rainbow-ordered strip; sort by saturation and the vivid colors line up. The node renders a preview strip of the sorted blocks and returns the five hex strings separately.

The inputs that matter

  • image - the IMAGE to analyze.
  • algorithm - the five-way choice: K-Means Clustering (default), Median Cut, Histogram Frequency, High Saturation, Center Weighted. Same semantics as the other palette nodes - K-Means for a balanced read, High Saturation for brand-style colors, Center Weighted when the subject sits mid-frame.
  • sort_mode - Hue (default), Saturation, or Brightness. This is the input that makes this node distinct from its siblings.

Outputs: palette_image (the preview strip) plus color1 through color5 - five STRING hex values in the sorted order.

Install

Pack install as usual:

cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Image.git
pip install -r ComfyUI-S4Tool-Image/requirements.txt

Or ComfyUI Manager → search "S4Tool-Image" → Install → restart. No models - scikit-learn and numpy only.

Gotchas

  • Hue-sorted ≠ importance-sorted - color1 is not "the most dominant color" here; it's the first after sorting. If you need dominance order, use 💀Image Primary Color or 💀Image Palette 6-3-1, which don't re-sort.
  • Five hex strings, wire them individually - there's no combined "palette" string output; each color is its own port, so feeding them somewhere usually means routing a few wires.
  • The preview is a strip, not the source - palette_image shows the five colors as blocks for eyeballing; the actual data you want lives in the hex outputs.

For "what does this image actually look like in color" - pulling a reference's palette to drive a themed composition, matching a character's outfit colors, or just understanding an image's mood at a glance - this is the most complete one-stop node in the pack.

Category💀S4Tool

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
algorithmCOMBOK-Means Clustering5 options: K-Means Clustering, Median Cut, Histogram Frequency, High Saturation, Center Weighted
sort_modeCOMBOHue3 options: Hue, Saturation, Brightness

Outputs (6)

NameTypeDescription
palette_imageIMAGE
color1STRING
color2STRING
color3STRING
color4STRING
color5STRING