def _rescale_image(image: Union[ndarray, ImageType]) -> ndarray:
    """rescales the image to be between 0-255
        assumes positive values as it does not correct a bias

    Args:
        image (ndarray): the input image to rescale

    Returns:
        ndarray: the rescaled image
    """

    if isinstance(image, ImageType):
        image = np.array(image.convert('RGB'))

    image = image*1.0
    image /= image.max()
    image *= 255
    image = image.astype(np.uint8)
    return image
rescales the image to be between 0-255
        assumes positive values as it does not correct a bias

    Args:
        image (ndarray): the input image to rescale

    Returns:
        ndarray: the rescaled image
    
src/marqo/s2_inference/processing/DINO_utils.py