FUNCTION ADJUST, TRUE, SATURATION=SATURATION, LIGHTNESS=LIGHTNESS ;- Adjust the saturation and lightness of a true color image ;- Check arguments if (n_elements(true) eq 0) then message, 'Argument TRUE is undefined' if (n_elements(saturation) eq 0) then saturation = 1.25 if (n_elements(lightness) eq 0) then lightness = 1.05 ;- Check for properly formed true color image dims = size(true, /dimensions) if (dims[2] ne 3) then message, 'Argument TRUE must be dimensioned [NX, NY, 3]' ;- Get red, green, and blue channels red = true[*, *, 0] grn = true[*, *, 1] blu = true[*, *, 2] ;- Convert to hue, lightness, saturation color_convert, red, grn, blu, h, l, s, /rgb_hls ;- Adjust the saturation and lightness s = ((saturation * temporary(s)) > 0.0) < 1.0 l = ((lightness * temporary(l)) > 0.0) < 1.0 ;- Convert back to red, green, blue color_convert, h, l, s, red, grn, blu, /hls_rgb ;- Store the red, green, and blue channels true_adj = true true_adj[0, 0, 0] = red true_adj[0, 0, 1] = grn true_adj[0, 0, 2] = blu ;- Return the image to the caller return, true_adj END