Color ratioπŸ”—

Given a reference color and a color sample, calculates scaling factors suitable for color balancing. For accurate results, linear colors should be used as input. See gamma correction for details.

InputsπŸ”—

  • referenceColor: The reference color.

  • color: A color sample. If a channel in the color is zero, the corresponding scaling factor will be set to one.

  • normalize: If true, the input colors are normalized to equal intensity (luminance) before calculating the scaling factors. This way, the calculated scaling factors won’t change average intensity. If this flag is false, the scaling factors are calculated from non-normalized input colors.

OutputsπŸ”—

  • scalingFactors: Scaling factors for each color channel represented as a 1-by-3 matrix. The order is red, green, blue.