I think the answer is in the name bayer_preserved. In the code the raw image is captured, which has pixels of Blue Green Green Red. The 8MP camera has not got all four colours at each position, there are only 8 million sensors, 2 million Blue, 2 million Red and 4 million Green. Despite working with colour cameras for years I only realised this last week: all colour cameras only actually have 1/4 of the pixels that they claim for full colour information. The rest is interpolated.
The code seems to take the raw data from the camera and process it as a 2D array of the raw pixels. This 2D array is interpreted as a greyscale image in the PNG. A colour image would have a 3rd dimension for the three colours, which you get by demosaicing the Bayer pattern. Even for a true greyscale image you need to average the BGGR blocks in your array.