from PIL import Image
def compress_image(image_path, output_path, max_size):
"""Compresses an image file to a specified max size in bytes."""
# Open the image
with Image.open(image_path) as image:
# Get the original image size
...