properly expand grayscale data