def get_rescale_ratio(image, target):
    """Gets the required ratio to rescale an image to a target resolution

    :param image: An image to resize.
    :param target: The target resolution to resize to.
    :type image: Image
    :type target: int
    :return: The min of the ratio between the target resolution and the image's smallest dimension, and 1.
    :rtype: float
    """
    width = image.width
    height = image.height

    if width <= target or height <= target:
        return 1

    ratio = target / min(width, height)
    return ratio