Cast image to char

Rescale the image intensity values.
Cast the image to unsigned char.

write the output to stdout.