ComfyUI > Nodes > ComfyUI-Color_Transfer > PalleteTransferClustering

ComfyUI Node: PalleteTransferClustering

Class Name

PalleteTransferClustering

Category
Color Transfer/Palette Transfer
Author
45uee (Account age: 2626days)
Extension
ComfyUI-Color_Transfer
Latest Updated
2025-05-12
Github Stars
0.02K

How to Install ComfyUI-Color_Transfer

Install this extension via the ComfyUI Manager by searching for ComfyUI-Color_Transfer
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Color_Transfer 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

PalleteTransferClustering Description

Facilitates color palette transfer between images using clustering algorithms for artists and designers.

PalleteTransferClustering:

The PalleteTransferClustering node is designed to facilitate the transfer of color palettes between images using clustering techniques. This node leverages the power of clustering algorithms, specifically KMeans and MiniBatchKMeans, to identify and transfer dominant color palettes from a source image to a target image. By clustering the colors in an image, it effectively reduces the complexity of color data, making it easier to manipulate and transfer. This process is particularly beneficial for artists and designers who wish to harmonize the color schemes of different images or apply a specific color style across multiple artworks. The node's primary goal is to provide a seamless and efficient method for color palette transfer, enhancing the visual coherence and aesthetic appeal of digital art projects.

PalleteTransferClustering Input Parameters:

cluster_method

The cluster_method parameter determines the clustering algorithm used to identify the dominant colors in the image. It accepts options such as "Kmeans" and "Mini batch Kmeans". The choice of method can impact the speed and accuracy of the clustering process. "Kmeans" is a traditional clustering method that is effective but can be computationally intensive, while "Mini batch Kmeans" is a faster alternative that processes data in smaller batches, making it suitable for larger datasets. There are no specific minimum or maximum values, but the choice should align with the desired balance between performance and computational efficiency.

n_source_colors

The n_source_colors parameter specifies the number of color clusters to be identified in the source image. This parameter directly influences the granularity of the color palette extracted from the image. A higher number of clusters will result in a more detailed palette, capturing subtle color variations, while a lower number will produce a more generalized palette. The default value is set to 1000, which provides a comprehensive representation of the image's color scheme. Adjusting this parameter allows you to control the level of detail in the color transfer process.

PalleteTransferClustering Output Parameters:

source_centroids

The source_centroids output represents the central colors of the clusters identified in the source image. These centroids are the key colors that define the palette extracted from the image. They serve as the basis for transferring the color scheme to the target image, ensuring that the most representative colors are used in the process. Understanding these centroids is crucial for interpreting the resulting color transfer and making any necessary adjustments to achieve the desired visual effect.

transport_plan

The transport_plan output is a matrix that describes the optimal transport plan for transferring the color palette from the source image to the target image. This plan is computed using the Sinkhorn algorithm, which ensures an efficient and balanced transfer of colors. The transport plan is essential for understanding how the colors from the source image are mapped to the target image, providing insights into the effectiveness of the color transfer process.

PalleteTransferClustering Usage Tips:

  • Experiment with different cluster_method options to find the best balance between speed and accuracy for your specific project needs.
  • Adjust the n_source_colors parameter to control the level of detail in the color palette. A higher number of clusters can capture more subtle color variations, which may be beneficial for complex images.
  • Use the source_centroids output to analyze the dominant colors in your image and make informed decisions about color adjustments.

PalleteTransferClustering Common Errors and Solutions:

"ValueError: n_clusters should be a positive integer"

  • Explanation: This error occurs when the n_source_colors parameter is set to a non-positive integer or an invalid value.
  • Solution: Ensure that the n_source_colors parameter is set to a positive integer value that reflects the desired number of color clusters.

"ConvergenceWarning: Number of distinct clusters found smaller than n_clusters"

  • Explanation: This warning indicates that the number of distinct colors in the image is less than the specified n_source_colors.
  • Solution: Consider reducing the n_source_colors parameter to a value that is more appropriate for the image's color diversity.

PalleteTransferClustering Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Color_Transfer
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 Playground, enabling artists to harness the latest AI tools to create incredible art.