Added grayscale detection for bmp.