Nodes/ComfyUI_MiraSubPack/Tiled Image Color Correction
ComfyUI Node

Tiled Image Color Correction

Kill the seam lines — pull every sampled tile back toward the source's colors

By mirabarukaso·Created 8 months ago·Updated 2 months ago· 0
Tiled Image Color Correction
  • tiled_images
  • reference_tiles
  • corrected_tiles
color_correction_methodhistogram_match
color_correction_strength1.00
luminance_correction_strength0.00
edge_preserving_smooth0.0

Tiled upscaling has a tell: the tiles come back from the KSampler looking great individually and subtly wrong together - one tile slightly warmer, the next a bit brighter, and where they meet, a visible seam. That drift is the number-one reason tiled results look patchwork instead of photographic. Tiled Image Color Correction is the fix: it corrects each sampled tile against the original source tile so every piece lands on the same palette before the merge node stitches them.

This is the step the upscaling playbook keeps warning about - skip it and you get exactly the "patchwork artifacts" that give tiled diffusion a bad name. The pack even feeds you the reference: ImageCropTiles outputs a cropped_full_image precisely so you have the pristine source for this correction.

How it works

For each tile, it compares your sampled tile to the corresponding original (reference_tiles - same count, same order) and pushes the sampled tile's colors toward the reference. Three methods, from the source:

  • histogram_match (default) - full per-channel histogram matching. The strongest correction; good when tiles drifted a lot.
  • Color Transfer - mean & std matching in CIE LAB space (Reinhard 2001). More conservative, preserves contrast character better.
  • none - skip.

On top of that: luminance_correction_strength matches brightness/contrast after the color pass (0 = skip, 1 = full), and edge_preserving_smooth (0.3–0.5 recommended) applies a final smoothing that reduces the color stains and artifacts the correction can leave behind.

The inputs that matter

  • tiled_images - the sampled tiles, post-KSampler, pre-merge.
  • reference_tiles - the original tiles before sampling (the tiled_images output from ImageCropTiles). Same tile count as tiled_images, or the node has nothing to correct against.
  • color_correction_method - histogram_match or Color Transfer; start with the default.
  • color_correction_strength (default 1) - 0 = no correction, 1 = full. Dial back if corrected tiles start to look flat.
  • luminance_correction_strength - add brightness/contrast matching on top; handy when tiles vary in exposure rather than hue.
  • edge_preserving_smooth - artifact cleanup; 0.3–0.5 is the sweet spot.

One output: corrected_tiles, feeding straight into OverlappedImageMerge.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/mirabarukaso/ComfyUI_MiraSubPack

or search "MiraSubPack" in ComfyUI Manager and restart. No extra dependencies - the histogram and LAB math is all implemented in the pack.

Notes and gotchas

  • Order matters and count must match. Tiles are corrected positionally, so if reference_tiles and tiled_images don't line up you'll correct tile 4 against tile 6's source. Keep both outputs from the same pipeline run.
  • Don't overdo the strength. Full histogram match (1.0) on a source that was heavily regenerated can flatten the detail the sampler just added - this node is for color fidelity, not for erasing the upscale. If seams persist at 1.0, the drift is big enough that you should fix your denoise or per-tile prompts instead.
  • Use it as the default, not the exception. In a Mira ITU loop, this node between the KSampler and the merge is cheap and nearly always improves the result. The only case to skip it is when you want tiles to keep their independently generated look.
  • If you see color stains at tile borders after correction, nudge edge_preserving_smooth up rather than turning the method off.
CategoryMira/SubPack/Image Tiled Upscaler

Inputs (6)

NameTypeDefaultDescription
tiled_imagesIMAGESampled tiled images to be corrected (post-ksampler).
reference_tilesIMAGEOriginal tiles before ksampler (e.g. tiled_images output from ImageCropTiles). Must have the same tile count as tiled_images.
color_correction_methodCOMBOhistogram_matchColor correction method applied to each tile: none: Skip color correction. Histogram Match: Full per-channel distribution matching. Color Transfer: Mean & std matching in CIE LAB space (Reinhard 2001).
color_correction_strengthFLOAT1.000–1Blend strength for color correction: 0=no correction, 1=full correction.
luminance_correction_strengthFLOAT0.000–1Blend strength for luminance (brightness+contrast) correction applied AFTER color correction. 0=skip, 1=full luminance match. Can be combined with any color_correction_method.
edge_preserving_smoothFLOAT0.00–1Optional edge-preserving smoothing to reduce color artifacts/stains. 0=no smoothing, 0.3-0.5=recommended for artifact reduction, 1.0=maximum smoothing. Applied as final post-processing step.

Outputs (1)

NameTypeDescription
corrected_tilesIMAGE