adjusts the colors in image to achieve a balance that simulates the effect of neutral lighting.


adjusts colors in image so that the reference color specified by ref is mapped to white.


maps the reference color ref to target.

Details and Options

  • ColorBalance is typically used for white or gray balancing, removing unrealistic color casts from images. This usually results in representing objects with neutral colors as gray.
  • ColorBalance works with images with explicit color spaces. Images with ColorSpace->Automatic are converted to "RGB" or "Grayscale" before being adjusted.
  • Either of the ref or target can be any of the following:
  • colorexplicit color
    whitepointnamed white point as used as a setting for WhitePoint
    temperaturecolor specified by a temperature
    {temperature,tint}color specified by a temperature and a tint
    {pos1,pos2,}mean color at positions posi in the original image
    markerimagemean color sampled according to a marker image
  • The mean color above is computed in the Lab color space.
  • The temperature can be specified as a value in Kelvin, typically in the range 2000 K and 20,000 K. The tint can be given in units of , typically in the range and .
  • Temperature and tint can be visualized in the MacAdam chromaticity diagram below, where the curve corresponds to a radiating blackbody and tint adjustments are moves on isothermal lines, orthogonal to the temperature curve.
  • ColorBalance takes a Method option. Possible settings include:
  • "GrayScaling"scaling the mean of the image
    "RGBScaling"scaling in the RGB space
    "LMSScaling"scaling in the LMS space
    "ChromaticityScaling"scaling of the chromaticities in the LMS space
  • With the method "LMSScaling", the scaling is performed using the Bradford transformation matrix to convert between XYZ and LMS.
  • With a given {temperature,tint} pair, Method"ChromaticityScaling" is always used; otherwise, Method->"LMSScaling" is used.  »


open all close all

Basic Examples  (1)

Automatic white balancing to correct for blue cast:

Click for copyable input

Scope  (8)

Options  (6)

Applications  (4)

Properties & Relations  (2)

Possible Issues  (1)

Interactive Examples  (1)

Introduced in 2015