Set BMP image resolution before or with imwrite

I think you are out of luck, but using PIL, for example, could help. See here for PNG