pyUSID.io.image.read_image

pyUSID.io.image.read_image(image_path, as_grayscale=True, as_numpy_array=True, *args, **kwargs)[source]

Read the image file at image_path into a numpy array either via numpy (.txt) or via pillow (.jpg, .tif, etc.)

Parameters:
  • image_path (str) – Path to the image file

  • as_grayscale (bool, optional. Default = True) – Whether or not to read the image as a grayscale image

  • as_numpy_array (bool, optional. Default = True) – If set to True, the image is read into a numpy array. If not, it is returned as a pillow Image

Returns:

image – if as_numpy_array is set to True - Array containing the image from the file image_path. If as_numpy_array is set to False - PIL.Image object containing the image within the file - image_path.

Return type:

numpy.ndarray or PIL.Image.Image