Assigning colours to an image is complicated, if only because you have so many options. Basically, you write each converted value 3 times to the output file, with each value representing the red, blue, and green shade of a single pixel. Each value is a multiple of the original greyscale pixel, and can be set with a piece of code that "colorizes" the output value depending on its intensity.
SELECT CASE OutputValue
	CASE IS < 14    'All values below 14 are equal, making them greyscale
		red = 1
		blue = 1
		green = 1
	CASE IS < 256   'strong blue
		red = .5
		blue = 1
		green = .5
	CASE IS < 512   'value rolls over, but now it's cyan
		Outputvalue = Outputvalue - 256
		red = 0
		blue = 1
		green = 1
	CASE ELSE        'let it crash if it's too high, to locate bug
END SELECT

WRITE OutputValue * red
WRITE OutputValue * blue
WRITE OutputValue * green
Naturally you can set the rgb multiples to different values, and have intermediate conditional values to create more colours.
Back