Photography‎ > ‎

Colortemp

colortemp is a Gimp script for changing the color temperature of an image. It can be used to correct the red color cast of photos taken under incandescent light with the camera on daylight setting, or to correct the blue cast of outdoor photos taken in overcast conditions. The color conversions are based on black-body colors at various temperatures, and are performed in the sRGB color space. In Gimp 2.4, more colorspaces are supported, but the plugin has not yet been adapted to work with general colorspaces.

Once installed, the script is available from the menu item Filters/Colors/Convert Color Temperature.

Download and Installation

  • Download colortemp.scm for Gimp 2.2, 2.4, and 2.6 from the attachments section at the bottom of this page.
  • To install, put the script in the appropriate directory, then click on the menu Filters / Script-Fu / Refresh Filters.  On the Mac, the appropriate directory is Library/Application Support/Gimp/scripts/

Usage

You can specify the color temperature of the original image, and the desired color temperature of the result, as well as a light intensity correction factor. There are two ways of specifying the color temperature of the original image:
  1. (Option: 'From slider below') You can use a slider to specify the color temperature of the original.
  2. (Option: 'From foreground color')  Point the color picker tool at something that was white in the photo (example: snow, clouds, a white T-shirt, white paper), and select its color as foreground color.  Colortemp will compute the color temperature of the light when the photo was taken, and it will use that color temperature as the source temperature.  (Details: the script will use as the original temperature the temperature at which a black body is of color closest to the foreground color.)
The first method can be used when you know the color temperature of the source, and does not require the image to contain a white or grey object. For example, to convert from from incandescent to daylight, select 'From slider below', choose 2800K as temperature of the original, and 6500K as the target color temperature.

To use the second method, use the color picker tool to pick the color from a gray or white object in the scene.

The Intensity slider is used to modify the intensity of the image; this can be useful to avoid clipping of channels. The saturation slider can be used to modify the saturation of the image. Sometimes, when performing a large change in color temperature, the effect is more natural if the image is desaturated a little bit.

If you wish to make the foreground color white, you should consider using the whitebalance or grey-point script-fu's.

The color transformation of this color script is performed in the linear, rather than gamma-corrected, color space (as it should, for modifying color temperature). The gamma-corrected color space is the usual one, where a color pixel can have a value from 0 to 255. If x is the value of a pixel in this gamma-corrected space, the value of the pixel in the linear space is approximately (x / 255)^2.2 (the actual conversion is slightly more involved).

The color conversion performed by this script is based on the color of a black body, in the sRGB color space, as a function of temperature. The calculations are correct only for the official sRGB color space, with D65 (6500 K) as white point, and with the sRGB gamma, which is approximately equal to 2.2. As the conversion is based on black-body temperature, it does not necessarily work well for non-black-body light sources, such as mercury lamps, fluorescent lamps, and so forth.

ċ
colortemp.scm
(10k)
Luca de Alfaro,
Feb 26, 2009, 2:14 AM
Comments