Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-PhotoDeblur > Match Input Tone (Optional) · Photo Deblur

ComfyUI Node: Match Input Tone (Optional) · Photo Deblur

Class Name

PhotoDeblurToneMatch

Category
Photo Deblur/optional
Author
porfeng (Account age: 756days)
Extension
ComfyUI-PhotoDeblur
Latest Updated
2026-11-11
Github Stars
0.09K

How to Install ComfyUI-PhotoDeblur

Install this extension via the ComfyUI Manager by searching for ComfyUI-PhotoDeblur
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-PhotoDeblur in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Match Input Tone (Optional) · Photo Deblur Description

Matches deblurred photos to original color and brightness while preserving restored detail.

Match Input Tone (Optional) · Photo Deblur:

PhotoDeblurToneMatch is an optional finishing node that helps a deblurred photo retain the broad color and brightness appearance of its original version. Restoration can improve sharpness while also introducing unwanted tonal shifts, such as a warmer color cast or uneven changes in brightness. This node reduces those shifts by measuring the difference between the two versions, smoothing that difference with a Gaussian blur, and subtracting the smoothed difference from the restored version. In practical terms, it aims to bring large, smooth areas of color and illumination closer to the original while retaining finer restored detail. It is a spatial tone correction rather than histogram matching or an additional deblurring model, and its smoothing scale determines how much local variation is included in the correction. Processing runs on the CPU and requires OpenCV.

Match Input Tone (Optional) · Photo Deblur Input Parameters:

original

A required IMAGE that provides the reference appearance for tone correction, normally the photo before deblurring. The node uses its first three color channels as the reference for measuring changes in color and brightness; it does not simply replace the restored image with this reference. For meaningful results, connect the same source photo that was used for restoration, with the same composition and pixel alignment. Its complete image shape must match restored, including batch size, height, width, and channel count, so an RGB image and an RGBA image do not qualify as matching even if their visible dimensions are identical. For batches, each image is compared with the image at the same batch position. There is no default image, numerical minimum, maximum, or selectable option for this parameter.

restored

A required IMAGE containing the restored photo whose tone you want to adjust. This is the starting point for the result: the node copies it, calculates the difference between its first three color channels and those of original, and removes the smoothly varying part of that difference. Its fine details can therefore remain while broader tonal shifts are reduced, although small smoothing scales can also remove some restoration changes. The complete shape must match original, and corresponding images must be spatially aligned. If this image has an alpha channel, alpha is not included in the tone-matching calculation; it is carried through from this image, subject to the final range clamp when correction is enabled. The node works on a detached copy, so it does not modify the connected image in place. There is no default image, numerical minimum, maximum, or selectable option for this parameter.

sigma

A required FLOAT controlling the Gaussian smoothing scale used to separate broad tonal differences from finer detail. The default is 16.0, the minimum is 0.0, the maximum is 128.0, and the interface step is 1.0. The scale is measured in image pixels, so its visual effect depends on image resolution. Larger positive values smooth the difference over a wider area, focusing the correction on broader color and illumination changes while generally leaving more local restoration differences intact. Smaller positive values include more localized differences in the correction and can pull the result closer to the original at the cost of reducing recovered detail. This is a scale control, not a simple correction-strength slider. Setting it to exactly 0 disables the correction and returns a CPU float32 copy of restored without applying the final range clamp; OpenCV is still required because the dependency check happens before this bypass.

Match Input Tone (Optional) · Photo Deblur Output Parameters:

image

The single IMAGE output contains the restored image after tone matching, or an uncorrected copy when sigma is 0. With a positive sigma, each image in the batch is processed separately: the node subtracts a Gaussian-smoothed version of the restored-minus-original RGB difference, then clamps the entire result to the normal image range of 0 to 1. The intended result combines restored fine detail with broad tones that more closely resemble the original, rather than guaranteeing an exact color match at every pixel. Batch size, spatial dimensions, and channel count remain unchanged. For RGBA images, alpha comes from restored and is not tone-corrected, although the final clamp also limits alpha to 0–1. The returned image is stored on the CPU in float32 format. When sigma is 0, no clamping is performed, so any existing values outside the normal range remain unchanged.

Match Input Tone (Optional) · Photo Deblur Usage Tips:

  • Place this node after your restoration stage. Connect the pre-restoration photo to original and the corresponding restored result to restored, then send image to your preview or save node.
  • Start with sigma at its default of 16.0 and compare the corrected image with the uncorrected restoration. Check broad areas such as skin, skies, walls, and shadows for unwanted brightness or color changes.
  • Increase sigma if correction is removing desirable local contrast or recovered texture. A larger smoothing scale focuses more narrowly on broad tonal differences rather than smaller image features.
  • Decrease sigma cautiously if unwanted tonal changes are more localized. Inspect fine edges and textures afterward, because small positive values can also subtract detail improvements introduced by restoration.
  • Treat sigma as resolution-dependent. If you resize both images to a substantially different resolution, reassess the setting; keeping approximately the same relative smoothing scale generally requires scaling sigma with the image dimensions, within its available range.
  • Use sigma 0 for a no-correction comparison, but do not rely on it to bypass a missing OpenCV installation. To run without OpenCV, bypass this node entirely.
  • Keep both branches aligned. Apply any crop, resize, rotation, or batch reordering consistently before connecting the images; matching dimensions alone will not prevent incorrect correction when the content is misaligned.
  • Install requirements-tone.txt into the Python environment that actually runs ComfyUI, then restart ComfyUI. Installing it into an unrelated system Python environment will not make OpenCV available to this node.
  • For large batches or very high-resolution photos, allow for CPU processing and additional memory use. If memory becomes limited, process fewer images at once, since the node creates a full-size copy of the restored batch and additional working data during correction.

Match Input Tone (Optional) · Photo Deblur Common Errors and Solutions:

Optional tone matching needs OpenCV. Install requirements-tone.txt into ComfyUI Python, or bypass this node.

  • Explanation: The node could not import OpenCV, which supplies the Gaussian blur operation. This dependency is checked even when sigma is 0.
  • Solution: Install the packages listed in requirements-tone.txt using the Python environment that runs ComfyUI, then restart ComfyUI. If you do not need tone matching, connect the restoration result directly to the next node instead.

Original and restored images must have identical dimensions.

  • Explanation: The two image tensors have different shapes. Despite the wording of the error, this check includes batch size and channel count as well as height and width. For example, an RGB reference and an RGBA restoration will fail this check.
  • Solution: Make sure both images have the same width, height, number of images, and RGB or RGBA format. Apply equivalent resizing or cropping where needed, and verify that each restored image still corresponds to the reference at the same batch position.

OpenCV error from GaussianBlur

  • Explanation: OpenCV can report an operation-specific error if the image data reaching the blur operation is empty or has an unsupported layout. The exact message depends on the OpenCV version and the supplied data. This node checks matching shapes, but it does not perform a full validation of image structure.
  • Solution: Supply standard, nonempty ComfyUI RGB or RGBA IMAGE data arranged as batch, height, width, and channels. Do not connect raw latent data, masks, or custom tensors without converting them to a valid IMAGE first. Confirm that sigma is within the supported 0–128 range if your workflow sets values programmatically.
  • Explanation: Large images or batches can exhaust available system RAM while the node creates its CPU float32 copy and temporary arrays. The exact allocation error depends on whether the failure occurs in PyTorch, NumPy, or OpenCV; this node does not provide a custom out-of-memory message.
  • Solution: Process smaller batches, close applications that consume substantial RAM, or reduce image dimensions if acceptable. If you resize, resize both inputs identically. Bypass the node when tone correction is unnecessary; reducing sigma does not remove the need for the full-size image copy.

Match Input Tone (Optional) · Photo Deblur Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-PhotoDeblur
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Match Input Tone (Optional) · Photo Deblur