Fixed a possible bug with constant colour images.