ColorBalance¶
White-balances an image against a reference color.
ColorBalance[image, col] scales the three cone responses of every pixel so
that col lands exactly on white — the point of white balancing:
Balancing against white is therefore the identity:
$ wo 'ImageData[ColorBalance[Image[{{{0.2, 0.4, 0.6}}}], White]]'
{{{0.20000000298023224, 0.4000000059604645, 0.6000000238418579}}}
Correcting for a green cast pulls the green channel down relative to the other two, so a neutral gray comes back magenta:
A rule sends the reference somewhere other than white:
A single-channel image carries no color to rebalance and comes back as it went in:
$ wo 'ImageData[ColorBalance[Image[{{0.3, 0.7}}], Green]]'
{{0.30000001192092896, 0.699999988079071}}
A first argument that is not an image is reported: