def METHOD_NAME(im, size):
    im_width, im_height = im.size
    width, height = size
    if im_width < width and im_height < height:
        im = im.resize(size, Image.Resampling.LANCZOS)
    return im