AQ_ColorMatchImage
Steal a reference photo's color grade for a whole batch of images
- images
- reference
- IMAGE
Ever generated twelve images and wished they all shared one photo's look? That's this node's entire job: force the color of a whole batch to match a reference image. It's a color-grade transfer by statistics - the classic "make my AI output look like the moodboard" trick, but it works on a full batch at once instead of one image at a time.
How it works
The mechanism is per-channel mean normalization, with a local option. With blur_size set to 0 it computes each image's per-channel mean and scales every channel so the mean lands on the reference's mean. That's global color-cast transfer: warm photos make warm output, teal shadows become teal. With blur_size above 0 it goes local - it blurs both images (gaussian blur, or a guided filter if you pick guidedFilter) and divides/multiplies per-pixel by those blurred values. Local transfer preserves contrast while matching color neighborhood by neighborhood, which handles images that have a color cast in one region but not another. factor then lerps between the original and the result, so 0.5 gives a half-strength match and negative values push away from the reference.
If the reference batch is shorter than your image batch, the first reference frame is repeated to cover it.
Inputs
images- your batch.reference- the look you're after.blur_type-blur(gaussian) orguidedFilter. Guided filter is usually better at preserving edges; it needscv2.ximgproc, see below.blur_size- 0 means global; higher means more local. Default 0.factor- -10 to 10, default 1.
Output
One IMAGE per input frame, same dimensions.
Install
It's part of AQnodes:
cd ComfyUI/custom_nodes
git clone https://github.com/2frames/ComfyUI-AQnodes
cd ComfyUI-AQnodes
pip install -r requirements.txt
or search "AQnodes" in ComfyUI Manager and restart. The pack imports cv2 at startup, so OpenCV has to be present - normally fine, since insightface pulls in opencv-python as a dependency. But the guided filter specifically imports from cv2.ximgproc, which lives in opencv-contrib-python, not the plain build. If you hit an import error on guidedFilter, pip install opencv-contrib-python fixes it.
Gotchas
Be realistic about what it does: it transfers color statistics, not a "grade." You get the cast, not contrast curves or a learned style. It's a batch-friendly Reinhard-style match, which is the right tool when you need consistency - unifying a set of renders to one reference - and the wrong tool when you want creative color grading. Large blur_size values internally downscale the image to keep it fast, so don't expect perfect fidelity at the extreme end.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| reference | IMAGE | — | |
| blur_type | COMBO | 2 options: blur, guidedFilter | |
| blur_size | INT | 00–1023 | — |
| factor | FLOAT | 1.00-10–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |