from PIL import Image
# Load the two images
image1_path = "/mnt/data/file-6uCWGVXyH3FKqJK9RUQWgZ"
image2_path = "/mnt/data/file-93A7QBBo7iq6Yhygp5VqYP"
image1 = Image.open(image1_path)
image2 = Image.open(image2_path)
# Resize the images to have the same width
new_width = min(image1.width, image2.width)
image1 = image1.resize((new_width, int(image1.height * new_width / image1.width)))
image2 = image2.resize((new_width, int(image2.height * new_width / image2.width)))
# Combine the images vertically
new_height = image1.height + image2.height
combined_image = Image.new("RGB", (new_width, new_height))
combined_image.paste(image1, (0, 0))
combined_image.paste(image2, (0, image1.height))
# Save the combined image
combined_image_path = "/mnt/data/combined_image.jpg"
combined_image.save(combined_image_path)
combined_image_path