# White Balance Correction

## Summary

Color balance can be adjusted using the set of tools demonstrated in this cookbook. Let us first take a look at a couple of examples. In the first example, the upper image has a brownish tone and in the second example it has a blueish tone in the background. After the white balance correction, the background is corrected as white.

• Example 1. Correcting a brownish background.
• Example 2. Correcting a blueish background.

• The pixel intensities are linearized in Gamma Correction which has been configured to Compress mode. In this example we assume that the original image has been corrected with a gamma value 2.2. However, if the image comes from a file, the most likely value is sRGB. It is a special preset value configured to Gamma Correction tool. sRGB is also the default value. Linearization step is necessary in order to apply linear color balancing below.
• In this example, our mission is to correct the background color which is known to be white, but does not look white in the image due to differences in lighting. A reference area with the known color (in this case white) is sampled with a Color Sampling tool. The bigger the area, the better the result will be because more noise can be filtered out. The location of the area is selected by dragging the Frame input on the image display. In this case, the lower right corner of the image is selected for color sampling.
• The known reference color is set in Color Ratio tool. In this example, the reference value on each color channel is 240, so the reference color is nearly white. The color is given as a hexadecimal value in the order red, green, blue. So in this case, the hex value is f0f0f0 (f0 hex = 240 decimal). The tool outputs scaling factors for each color channel.
• Gamma expansion is applied to the linearized image with the same gamma coefficient as was used above in the compression step. The gamma value 2.2 is the best for contemporary display devices. If you want to save the image to a file, the best option is to use the default value sRGB. The mode in Gamma Correction tool is set as Expand.