This uses BMP image file which stores pixel data as it is, ie no compression of data.
It takes the RGB data, converts it to Monochrome (B&W) and assigns a character corresponding to its colour.
Black being written as @
or #
while white being written as whitespace or .
BMP files have some header information including the starting byte of the pixel data. You can read about it more from here