added greyscale and indexed color decoding