(data)
convert data in a array of uint8 in [0, 255].
convert data in a array of uint8 in [0, 255].
convert data in a array of uint8 in [ 0 255 ] .
def convert_data(data):
        """convert data in a array of uint8 in [0, 255]."""
        if data.dtype == np.float32 or data.dtype == np.float64:
            return np.array(255 * data, dtype=np.uint8)
        elif data.dtype == np.uint8:
            return data
        else:
            raise ValueError("The texture is in an unsupported format.")
def convert_data ( data ) : if data . dtype == np . float32 or data . dtype == np . float64 : return np . array ( 255 * data , dtype = np . uint8 ) elif data . dtype == np . uint8 : return data else : raise ValueError ( "The texture is in an unsupported format." )