in distilvit/pexels.py [0:0]
def resize_image(img):
max_size = 700
width, height = img.size
if width > max_size or height > max_size:
if width > height:
new_width = max_size
new_height = int(max_size * height / width)
else:
new_height = max_size
new_width = int(max_size * width / height)
img = img.resize((new_width, new_height), Image.LANCZOS)
return img