import math


def resize(size, hwRatio):
    """
    Return the minimum size of image that is at least "size" but
    maintains the provided aspect ratio
    """
    if size[0] * hwRatio > size[1]:
        return (size[0], int(math.ceil(size[0]*hwRatio)))
    else:
        return (int(math.ceil(1.0*size[1] / hwRatio)), size[1])