in clean_and_create/load_data.py [0:0]
def resize_large_images(image, max_image_size=2940):
width, height = image.size
aspect_ratio = width / height
resized = False
if width >= height and width > max_image_size:
width = max_image_size
height = int(width / aspect_ratio)
resized = True
elif height > width and height > max_image_size:
height = max_image_size
width = int(height * aspect_ratio)
resized = True
if resized:
image = image.resize((width, height), PIL.Image.LANCZOS)
return image