BMP image processing in C