It is hard to say without knowing the kind "grayscale" image you want to
convert to uint8. A grayscale images can be an m-by-n-by-3 RGB image (of
type double, single uint8 or uint16) with R = G = B, or an m-by-n image (of
type double, single, ...) indexed into the "gray" colormap.