The Algorithm is pretty simple, I've used the Wikipedia article BMP File format as my reference, the source is available in a GitHub repository.
//Program to analyze a Bitmap File.
//Please read the Wikipedia article follow this algorithm
//even more clearly.
//Moderate familiarity with C required to understand the
//the functions in the source code, but not the algorithm.
Openthe BMP file
Get the BMP Magic
Print the BMP Magic
**Nothing of Importance, just
the letters 'B' and 'M'
Get the BMP Header
Print the BMP Header
**Contains the Pixel Data Offset (address)
**Other Information (Not important):
Get the DIB` Header
Print the DIB Header
**Contains Width in Pixels (in pixels)
**Contains Height in Pixels (in pixels)
**Contains Pixel Depth (in bits)
**Other Information (not important):
>Header Size (in bytes)
>Compression Type (ENUM)
>Horizontal, Vertical (in pixels/m)
>No of color planes (usually 1)
>Pixel Data size (don't confuse with filesize)
>No of colors in palette (0 - default)
>No of important colors (0 - all are important)
No. of bytes per pixel = Pixel Depth / 8
Go the Pixel Data Offset
foreach x in Height (No. of rows)
foreach y in Width (No. of columns)
foreach b in [No. of bytes per pixel]
print [BYTE DATA]
//You can perform any other operation
//once you can print the information.
Close the BMP File
DIB: Device Independent Bitmap
NOTE: I've printed out all the information in the bitmap file though
The source code is available here.