COD: cast final image to an unsigned char