code: def to_uint8(self, data):
          
          np = util.get_module(
              "numpy", required="wandb.Image requires numpy if not supplying PIL Images: pip install numpy")
  
          # I think it's better to check the image range vs the data type, since many
          # image libraries will return floats between 0 and 255
  
          # some images have range -1...1 or 0-1
          dmin = np.min(data)
          if dmin < 0:
              data = (data - np.min(data)) / np.ptp(data)
          if np.max(data) <= 1.0:
              data = (data * 255).astype(np.int32)
  
          #assert issubclass(data.dtype.type, np.integer), 'Illegal image format.'
          return data.clip(0, 255).astype(np.uint8)
docs: Converts floating point image on the range [0,1] and integer images
          on the range [0,255] to uint8, clipping if necessary.