added algorithm for reading bmp and writing pixel values to new bmp