BMP file format is the simplest posible image format (only the simple compression if many points in the given line has exactly the same ray level)
In general it contains header and body with actuall gray levels (pixel by pixel). The color bmp contains the color map information inside their header.
I have written several lines of code ( in C ) which reads the BMP files but it is very primitive and was intended for my internal use so I dont recommend them to you.
But I am pretty sure that in the https://sourceforge.net/ you will find plenty of code on this subject.