Added Grayscale support

Also added Indexed support but not working properly as expected.