How are the colors for each pixel from a Ray Tracer stored in an Image?
It doesn't matter. All that matters is that you can store information per pixel. 

In most cases this means allocating a x*y array of ints (for 3 byte-sized channels of RGB) to store the pixel values and then feed it into your image compression library of choice to save it out to disk.