> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-mintlify-b90d3c69.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ColorTransfer - ComfyUI Built-in Node Documentation

> Complete documentation for the ColorTransfer node in ComfyUI. Learn its inputs, outputs, parameters and usage.

ColorTransfer 节点用于调整目标图像的调色板，使其与参考图像的颜色相匹配。它采用不同的数学算法，分析并将参考图像的色彩特征（如亮度、对比度和色调分布）迁移至目标图像。此功能有助于在多张图像之间实现视觉一致性，或应用特定的色彩分级效果。

## 输入

| 参数             | 描述                                              | 数据类型         | 是否必填 | 范围                                                   |
| -------------- | ----------------------------------------------- | ------------ | ---- | ---------------------------------------------------- |
| `image_target` | 需要应用色彩变换的图像。                                    | IMAGE        | 是    | -                                                    |
| `image_ref`    | 用于匹配颜色的参考图像。                                    | IMAGE        | 是    | -                                                    |
| `method`       | 使用的色彩迁移算法。                                      | COMBO        | 是    | `"reinhard_lab"`<br />`"mkl_lab"`<br />`"histogram"` |
| `source_stats` | 确定如何从源（目标）图像计算色彩统计信息。                           | DYNAMICCOMBO | 是    | `"per_frame"`<br />`"uniform"`<br />`"target_frame"` |
| `strength`     | 色彩迁移效果的强度。值为 1.0 时应用完整变换，值为 0.0 时返回原始图像。默认值：1.0 | FLOAT        | 是    | 0.0 至 10.0                                           |

**参数详情：**

* **`source_stats` 选项：**
  * **`per_frame`**：批次中的每一帧分别与 `image_ref` 进行匹配。
  * **`uniform`**：将所有源帧的色彩统计信息合并，创建单一基线，然后与 `image_ref` 进行匹配。
  * **`target_frame`**：从目标批次中选择一帧作为计算到 `image_ref` 变换的基线。此变换将统一应用于所有帧，从而保留帧之间的相对色彩差异。选择此选项时，将出现额外的 `target_index` 参数。
* **`target_index`**（当 `source_stats` 为 `"target_frame"` 时出现）：用作计算变换的源基线的帧索引（从 0 开始）。默认值：0。必须介于 0 和 10000 之间。

**约束条件：**

* 如果 `strength` 设置为 0.0 或 `image_ref` 为 `None`，节点将返回未经处理的原始 `image_target`。
* 当 `source_stats` 设置为 `"target_frame"` 时，`target_index` 必须是 `image_target` 批次中的有效索引。如果超出帧数，则使用最后一帧。
* 对于 `histogram` 方法且 `source_stats` 设置为 `"per_frame"` 的情况：如果 `image_ref` 的批次大小大于 1，则每个目标帧按索引与对应的参考帧进行匹配。如果参考批次只有一帧，则该帧将用于所有目标帧。

## 输出

| 输出名称    | 描述            | 数据类型  |
| ------- | ------------- | ----- |
| `image` | 应用色彩迁移后生成的图像。 | IMAGE |

> 本文档由 AI 生成。如果您发现任何错误或有改进建议，欢迎贡献！ [在 GitHub 上编辑](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ColorTransfer/zh.md)

***

**Source fingerprint (SHA-256):** `93a8447def4d2263a8a859c0474de694e6567dc6d32377032c2ddae2420bb10c`
