pseudo-colors

How do I create a pseudo-color image in C++?

I have an array of pixels with an associated intensity (as a float between 0 and 1) that I would like to convert to a RGB image. The easiest way would be to just multiply each value by 255 and assign it to R+G+B to obtain a greyscale image, but I think it would be better to use a whole range of colors to show finer differences. As far ...