Color Transfer


(released version: 2020.2.0)

Node Location: Composition

Summary Description:

Transforms the color palette of one image (the source) with the color palette of another image (the target), or via a manually selected color palette.

Technical Summary:

Color transfer uses a color space mapping algorithm that relies on identifying the key points within the source and destination color spaces and then minimizing the energy of the mapping between them. It uses spline basis functions as the energy functions to minimize using the palette colors as control points for the spline. By minimizing the energy, smooth transitions between colors can be achieved. In our implementation, black is always transferred to black. 

Palettes are built automatically from images by K-means clustering.

Inputs:

  • Source: the source image whose palette is to be transformed

  • Source Mask: allows you to restrict the source palette extraction and color transfer to a particular area of the source image.

  • Target: the image whose palette defines the transform

  • Target Mask: allows you to restrict the target palette extraction to a particular area of the target image.

Properties:

  • Source palette: a variable size (min 1, max 15) collection of color swatches representing the most prominent colors in the source image
  • Target palette: a variable size (min 1, max 15) collection of color swatches representing the most prominent colors in the target image.
  • Auto Palette: automatically generates a palette for the target and the source images, the number of colors is adjustable from 1 to 15.
  • Refresh Palette: re-executes palette extraction on the Source/Target inputs.
  • Delete: removes a transfer from the set.
  • Color Wheel: a tool that allows you to modify the color of a swatch using a color wheel.
  • Color Picker: a tool that allows you to modify the color of a swatch using an eyedropper tool. You can pick a color from anywhere on the screen.
  • Swap: allows you to swap the colors of any two swatches in the entire set.
  • Match (left/right arrow button): sets the target swatch to the color of the source swatch. Useful if there are particular colors you want to keep the same post-transform. 
  • Add Row: adds a row to the transfer set.

How to Use Color Transfer:

 Step by Step Guide
  1. Add two bitmaps (a source and target) to the node graph
  2. Connect one bitmap to the “Source” input of color transfer, the other bitmap to the “Target” input. The properties panel will populate the source and target palette columns with the number of swatches you have specified.
  3. Imbue the node to see the result.
  4. To use a source mask:
    1. Connect a Mask Paint node to the output of the source image. Connect the output of the mask paint to the Source Mask input on Color Transfer.
    2. Imbue the mask paint. Paint the areas of the source image you want to be affected by the transfer.
    3. Refresh the source palette and then imbue Color Transfer to see the result - only the painted area will have been affected
  5. To use a target mask:
    1. Connect a Mask Paint node to the output of the target image. Connect the output of the mask paint to the Target Mask input on Color Transfer.
    2. Imbue the mask paint. Paint the areas of the target image you want to extract colors from.
    3. Refresh the target palette and then imbue Color Transfer to see the result - the source image will only have been affected by the colors in the region you isolated in the target.


UX/UI Example Interaction:

Basic Color Transfer (no masks):

Using source mask to restrict affected area in the source image:

Using target mask to restrict target palette to an area in the image: