Rescaling to 8 bit for writing