Some cleaning, image read and write works properly for BMP files.