Nodes/ComfyUI S4Tool Image/💀Image Get Color
ComfyUI Node

💀Image Get Color

Read the hex of any single pixel

By S4MUEL-404·Created about a year ago·Updated 10 months ago· 4
💀Image Get Color
  • image
  • hex_color
x0
y0

Sometimes you need the exact color of a specific pixel - the skin tone at a coordinate, the sky at the top of the frame - and you don't want to export the image and sample it in another app. 💀Image Get Color from the S4Tool-Image pack is the tiny node that does it: you give it an image and an x,y position, it hands you the hex string of that pixel. That's the entire job, and it's a perfectly good job to have.

The mechanism is direct tensor indexing, not a rounding detour through files. The node clamps your coordinates to the image bounds, reads the RGB values straight from the tensor, and formats them as #RRGGBB. Grayscale input gets replicated to RGB so you still get a valid hex. The clamping detail is worth knowing: coordinates outside the image don't error - they snap to the nearest edge pixel, which keeps the node from blowing up mid-batch but also means an off-by-a-lot coordinate silently returns an edge color.

Inputs and output

  • image - the IMAGE to sample.
  • x (0–4096, default 0) and y (0–4096, default 0) - pixel coordinates. Note x is horizontal, y is vertical, and (0,0) is the top-left, matching tensor convention.

Output: hex_color (STRING) - e.g. #A1B2C3.

Where it earns its keep: sampling a reference image to extract a precise color for a color-string parameter (the sky tint at a given coordinate), grabbing a border color for a matte, or reading a calibration target's color in an automated pipeline. It's the surgical counterpart to the pack's palette nodes - those give you the overall story, this one gives you one exact point.

Install

Standard pack install:

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, no downloads - it's pure tensor math.

Gotchas

  • Coordinates are clamped, not rejected - out-of-range values return an edge pixel rather than an error. If you're scripting a batch, be aware a typo'd coordinate won't complain.
  • It reads one frame - if the input is a batch/sequence, only the first frame is sampled. For per-frame sampling you'd process frames individually.
  • Transparency note - the output is the RGB value; alpha isn't part of the hex. Sampling a fully transparent pixel gives you whatever color is stored underneath, which may be meaningful or garbage depending on the source.

It's the kind of node you forget exists until you're three steps into a workflow and realize "I just need one pixel's color" - and here it is.

Category💀S4Tool

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
xINT00–4096
yINT00–4096

Outputs (1)

NameTypeDescription
hex_colorSTRING