adding experimental bmp file writing support for debugging