Nodes/Eden.art nodesuite/HistogramMatching
ComfyUI Node Runs on cloud

HistogramMatching

Steal the color grade of one image and stamp it on a whole batch

By edenartlabΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 119
HistogramMatching
  • ref_image
  • target_images
  • IMAGE
β—„matching_fraction0.75β–Ί
β—„channels0,1,2β–Ί

HistogramMatching is the color-correction shortcut: take one image you like the look of, and force a batch of other images to adopt its color distribution. You've got a reference photo with moody teal shadows and you want your whole set of renders to share that grade. This node does it with classic histogram matching - no neural networks, no CLIP, just per-channel math.

It's part of eden_comfy_pipelines, Eden.art's 70+ node suite. It's one of the pack's most straightforwardly useful image tools.

What you set

  • ref_image - the image whose color distribution you're copying. This is the reference, the look you want.
  • target_images - the image(s) to be recolored. Batch-friendly: you can feed a whole stack and they all get matched.
  • matching_fraction - how much of the reference's histogram to use, 0–1, default 0.75. Lower values do a more conservative match and leave more of the original look; 1.0 goes full transfer.
  • channels - which channels to match, as a comma-separated string like "0,1,2" (default = all three RGB channels). Matching only channel 0 changes just red, which can be handy for a subtle tweak.

One output, IMAGE, the recolored batch.

How it works

Histogram matching is old-school image processing, not AI: for each channel you pick, it builds the cumulative distribution of the reference, then remaps the target's pixel values so its distribution lines up with the reference's. The implementation here is a custom numpy/OpenCV take on the classic approach, inspired by the image-statistics-matching repo. The matching_fraction interpolates how far toward the reference distribution each target gets pushed - 0.75 means "mostly there," not "fully." It runs on CPU, so it's fast, and it handles a whole batch in one pass.

Two things to know before you expect magic. First, it transfers color distribution, not lighting or composition - a bright daytime render won't become a dark night scene, it'll just adopt the reference's tones and contrast profile. Second, the matching is per-channel and global, so it can shift local color relationships; heavily saturated sources can end up looking slightly over-processed at 1.0. That's exactly what matching_fraction exists to tune.

Where it shines

  • Batch consistency: render 40 variations, match them all to one approved image, and your series suddenly looks like one cohesive set.
  • Look transfer between styles: match your output to a film still or a moodboard image to inherit its grade.
  • Pre-VAE consistency: recolor images before they feed into an img2img or IP-adapter step so the model sees a consistent color story.

The gotchas

The channels string is parsed with split(',') and int() - a stray space ("0, 1, 2") will throw. And because it converts everything through OpenCV's BGR/RGB flip, don't be surprised if a single mis-wired channel produces a red/blue swap; wire the reference and targets from the same kind of source and you're fine.

Installing it

Standard pack install - ComfyUI Manager (search "eden"), or:

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

Restart ComfyUI. It leans on numpy and OpenCV, both in the pack's requirements - no model downloads, no API keys, runs on CPU. For a node with zero setup, "make everything match this one image" is a lot of value.

CategoryEden 🌱

Inputs (4)

NameTypeDefaultDescription
ref_imageIMAGEβ€”
target_imagesIMAGEβ€”
matching_fractionFLOAT0.750–1β€”
channelsSTRING0,1,2β€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”