ComfyUI Node

🔴 PIP 颜色拾取

Three matching hex colors from any image, in one click

By chenpipi0807·Created about a year ago·Updated 6 days ago· 30
🔴 PIP 颜色拾取
  • image
  • 填充色
  • 描边色
  • 阴影色
grid_blocks40

The name undersells it slightly: PIP ColorPicker doesn't let you click a color - it derives one. Point it at any image and it computes the average color, then hands back that color plus a brightened version and a darkened version as three hex strings. The entire point of those three outputs is to feed them into the pack's text nodes: a fill, an outline, and a drop shadow that are guaranteed to be the same hue family, because they came from the same source.

What it does

It's a two-input, three-output node, and that's the whole design. Input an IMAGE, and it returns:

  • 填充色 (STRING) - the average color, brightened ~30% in value. Meant for the text fill.
  • 描边色 (STRING) - the raw average color. Meant for the outline.
  • 阴影色 (STRING) - the average color darkened ~30%. Meant for the drop shadow.

Dark text with a brightened fill, mid-tone outline, and dark shadow is a coherent, readable look on almost any background. That's the recipe this node encodes.

How it works

Under the hood it's deliberately crude: it samples the image on a grid (the grid_blocks input, default 40, controls how many blocks per axis - more blocks = finer sampling), averages the sampled pixels (skipping near-transparent ones), and derives the three variants by shifting brightness in HSV space. It only ever reads the first frame of a batch. No histograms, no clustering - this is a quick-and-dirty average, and it's honest about being one.

The one input that matters:

  • grid_blocks - sampling density (1–200). At low values like 4, the average skews toward whatever few points get hit. At the default 40, a 1024×1024 image samples 1600 points, which is plenty. Crank it up if you're processing huge images where 40×40 misses fine detail.

The natural workflow

Run it on your background, then paste 填充色 / 描边色 / 阴影色 into PIP ArtisticWords Fusion's 填充颜色 / 描边颜色 / 阴影颜色 fields. That's the pack's intended loop: analyze once, get a palette that harmonizes with the image for free. You can do the same into the SVG path by editing the style files, but the direct paste-into-Fusion route is the frictionless one.

Installing it

It ships in the PIP_ArtisticWords pack, so installing the pack once gets you all seven nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/chenpipi0807/PIP_ArtisticWords.git
cd PIP_ArtisticWords
pip install -r requirements.txt

Or search "PIP Artistic Words" in ComfyUI Manager, then restart. Lightweight deps only (Pillow, numpy, opencv-python, webcolors); the README claims sub-second processing and that holds up - this is a handful of getpixel calls.

Gotchas

  • It's an average, not a choice. If your image is a sunset over a gray sea, you get "muddy orange-gray," not the vibrant sky. Feed it a crop or a flat-color image if you want a clean result.
  • Chinese output names. 填充色 / 描边色 / 阴影色, like the rest of this pack's later nodes. Wire by position if your UI doesn't translate them.
  • Hex is lowercase (#4096ff). Every color field in the pack accepts it, but don't compare against uppercase strings without normalizing.
  • It reads the first frame only. Batched image inputs won't give you per-frame colors - batch first if that's what you need.
CategoryPIP

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
grid_blocksINT401–200

Outputs (3)

NameTypeDescription
填充色STRING
描边色STRING
阴影色STRING