BMP encoding: fix inverted color planes