Convert binary file to grayscale image