code: def get_image_content(image):
      if isinstance(image, six.string_types):
          if not os.path.exists(image):
              raise FileNotFound(image)
          with open(image, "rb") as image_file:
              return image_file.read()
  
      elif isinstance(image, numpy.ndarray):
          return _get_numpy_as_image(image)
  
      elif isinstance(image, Image.Image):
          return _get_pil_image_data(image)
  
      else:
          try:
              from matplotlib import figure
  
              if isinstance(image, figure.Figure):
                  return _get_figure_as_image(image)
          except ImportError:
              pass
  
          try:
              from torch import Tensor as TorchTensor
  
              if isinstance(image, TorchTensor):
                  return _get_numpy_as_image(image.detach().numpy())
          except ImportError:
              pass
  
          try:
              from tensorflow import Tensor as TensorflowTensor
  
              if isinstance(image, TensorflowTensor):
                  return _get_numpy_as_image(image.numpy())
          except ImportError:
              pass
  
      raise InvalidChannelValue(
          expected_type="image", actual_type=type(image).__name__
      )
  
file_path: neptune-client/src/neptune/legacy/internal/utils/image.py
imports: import io
  import os
  import numpy
  import six
  from PIL import Image
  from neptune.legacy.exceptions import FileNotFound, InvalidChannelValue
label_desc: Use image node_id 1 for calling a global function with example usage: get_image_content(image) and returns: image_file, _get_numpy_as_image, _get_pil_image_data, _get_figure_as_image, _get_numpy_as_image, _get_numpy_as_image