Nodes/ComfyUI Essentials/πŸ”§ Image Histogram Match
ComfyUI Node Runs on cloud

πŸ”§ Image Histogram Match

Match one image's colors to a reference

By cubiqΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,152
πŸ”§ Image Histogram Match
  • image
  • reference
  • IMAGE
β—„methodβ–Ύβ–Ί
β—„factor1.00β–Ί
β—„deviceβ–Ύβ–Ί

Color drift is one of those problems that sneaks up on you. You run an image through img2img, or upscale it, or generate a batch meant to look like one series - and the palette shifts. Skin goes slightly green, the whites warm up, the batch stops feeling coherent. ImageHistogramMatch fixes it by pushing one image's color distribution toward a reference image's, so the output inherits the reference's tonal and color balance without you hand-tweaking curves.

It's from ComfyUI Essentials by cubiq (Matteo Spinelli, the ComfyUI_IPAdapter_plus author). Histogram matching is a classic image-processing operation, and having it as a node means you can do color grading inside the graph instead of round-tripping to Photoshop.

How it works

The node compares the statistical distribution of pixel values - the histogram - between your image and the reference, then remaps your image's values so its distribution lines up with the reference's. The result keeps your content but takes on the reference's color character. The factor lets you apply that only partway, which is usually what you want: full matching can look heavy-handed, and a partial blend nudges the color without stomping on it.

The inputs and outputs that matter

  • image (IMAGE) - the one being corrected.
  • reference (IMAGE) - the look you want to match. This is the palette source.
  • factor (FLOAT, 0–1, default 1) - strength. Lower it for a subtle grade; 1 matches fully.
  • method - pytorch or skimage. Two implementations of the same idea; pytorch runs on the GPU path, skimage uses scikit-image on CPU.
  • device - auto, cpu, or gpu. Leave it on auto unless you're chasing a specific memory or speed issue.

Output: the color-matched IMAGE.

How to install it

ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:

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

then restart. The pip install matters here - the skimage method depends on scikit-image being present.

Common issues & troubleshooting

The skimage method errors out. That method needs scikit-image installed. If you cloned manually and skipped the requirements install, run the pip install -r requirements.txt line above, or just use the pytorch method, which doesn't need it. ComfyUI Manager normally pulls dependencies for you.

It's a great fit for tiled upscaling. When you upscale tile-by-tile and the tiles come back with slightly different color, matching each tile's histogram to the original source region keeps the reassembled image consistent - a natural companion to ImageTile/ImageUntile. The upscaling KB flags color divergence between tiles as a real seam source, and this is one lever against it.

The match looks overcooked. Drop the factor. Full matching forces your image entirely into the reference's distribution, which can crush contrast if the two are very different. A partial blend is usually more convincing.

Node missing after a Comfy update. Essentials is maintenance-only since April 2025; pack nodes have broken on newer builds. Update via Manager, or roll ComfyUI back if it's genuinely incompatible.

Categoryessentials/image processing

Inputs (5)

NameTypeDefaultDescription
imageIMAGEβ€”
referenceIMAGEβ€”
methodCOMBO2 options: pytorch, skimage
factorFLOAT1.000–1β€”
deviceCOMBO3 options: auto, cpu, gpu

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”