FUNCTION SCALE_IMAGE, IMAGE, X, Y ;- Create scaled image with specified histogram ;- Create output array dims = size(image, /dimensions) nx = dims[0] ny = dims[1] scaled = bytarr(nx, ny) ;- Scale the image for index = 0, n_elements(x) - 2 do begin x1 = x[index] x2 = x[index + 1] y1 = y[index] y2 = y[index + 1] m = (y2 - y1) / (x2 - x1) b = y2 - (m * x2) mask = (image ge x1) and (image lt x2) scaled = scaled + mask * byte(m * image + b) endfor ;- Scale the pixels greater than the maximum value mask = image ge x2 scaled = scaled + (mask * 255B) ;- Return the result return, scaled END FUNCTION ENHANCE, BAND01, BAND03, BAND04 dims = size(band01, /dimensions) nx = dims[0] ny = dims[1] true = bytarr(nx, ny, 3, /nozero) ;- Red channel x = [-0.01, 0.10, 0.45, 1.10] y = [ 0, 90, 210, 255] true[0, 0, 0] = scale_image(band01, x, y) ;- Green channel x = [-0.01, 0.10, 0.45, 1.10] y = [ 0, 90, 210, 255] true[0, 0, 1] = scale_image(band04, x, y) ;- Blue channel x = [-0.01, 0.10, 0.45, 1.10] y = [ 0, 90, 210, 255] true[0, 0, 2] = scale_image(band03, x, y) ;- Return result return, true END