Before revamping writeBMPImage()