π§ Image Histogram Match
Match one image's colors to a reference
- image
- reference
- IMAGE
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;1matches fully.method-pytorchorskimage. Two implementations of the same idea;pytorchruns on the GPU path,skimageuses scikit-image on CPU.device-auto,cpu, orgpu. Leave it onautounless 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| reference | IMAGE | β | |
| method | COMBO | 2 options: pytorch, skimage | |
| factor | FLOAT | 1.000β1 | β |
| device | COMBO | 3 options: auto, cpu, gpu |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |