def _get_size(max_size, image):
    """
    Returns a 2-tuple of (width, height).

    Calculates a new width and height given a width, height.
    The larger of the width and height will be the max_size
    The smaller of the two will be calculated so that the ratio is the
    same for the new width and height.
    """
    width = image.size[0]
    height = image.size[1]
    if width > height:
        return max_size, int(max_size * height / width)
    else:
        return int(max_size * width / height), max_size