def _compute_new_shape(length, height, width, trunc=True):
    """Computes the new target shape that results in the shortest side length.

    Parameters
    ----------
    length : float
        Length of the resulting shortest side
    height : float
        Image height
    width : float
        Image width

    Returns
    -------
    int or float
        New height
    int or float
        New width
    """

    if height < width:
        new_height = length
        new_width = width * length / height
    elif width < height:
        new_width = length
        new_height = height * length / width
    else:
        new_width = length
        new_height = length

    if trunc:
        new_height = int(new_height)
        new_width = int(new_width)

    return new_height, new_width