Added 16bit image support for grayscale