Inky Impression python displaying photos upside down

Hi all,

Floundering my way through python to get my lovely inky impression photo frame up and running.

One weird thing I’m seeing is a few photos displayed upside-down. Checking on the laptop, these photos are not upside down…!

Main bit of code:

    # Randomly select an image
    selected_image = random.choice(image_files)
    image_path = os.path.join(image_directory, selected_image)

    # Load the image
    img = Image.open(image_path)

    # Resize the image to fit the display (if necessary)
    img = img.resize(inky.resolution)

    # Convert the image to the appropriate mode
    img = img.convert("RGB")

    # Display the image
    inky.set_image(img)
    inky.show()

So I think the img.resize is flipping some pics… Any advice?
I’m looking at changing that line to accommodate portrait photos, too, so I’m very open to ideas on sizing various images to the display.

Thanks in advance,
Matt