How are the colors for each pixel from a Ray Tracer stored in an Image? I have begun learning how to create a Ray Tracer and 1 thing I am confused about is how the pixel color from a Ray Tracer is stored into an image. Do we use SetPixel for a Bitmap? Do we use a third party library like libpng?

Most tutorials don't really explain this well online, so if anyone can explain what the most common method for this is that would be great.
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.