import cv2


MAX_IMAGE_SIDE = 2000


def resize_large_image(image):

    height, width = image.shape[:2]

    max_side = max(height, width)

    if max_side <= MAX_IMAGE_SIDE:
        return image

    scale = MAX_IMAGE_SIDE / max_side

    new_width = int(width * scale)

    new_height = int(height * scale)

    resized = cv2.resize(
        image,
        (new_width, new_height),
        interpolation=cv2.INTER_AREA
    )

    return resized