def calc_resize_with_apect(size, min_dimension):
    """calculate the dimensions needed to resize an image with the minimum dimension on one side
    while preserving the aspect ratio.
    size: tuple containing the original image size in pixels (w,h)
    min_dimension: min pixel size on one size
    """
    w = size[0]
    h = size[1]

    new_w = (w / min(size)) * min_dimension
    new_h = (h / min(size)) * min_dimension

    new_size = (int(new_w), int(new_h))

    return new_size