Streamlit Image_rotated

Continuing the discussion from How do I show image in original size?:

Summary

I’ve 10 images and I am using a for loop to get all image and using time.sleep(3) , so I can see a slideshow of all 10 images. The problem is some of the images are automatically rotated 90 degrees whereas some 180 degrees (flipped). I do not want my images to be rotated. How can I fix this. below is the code?

Steps to reproduce

Code snippet:

 placeholder.image(image, caption='2022 UK Trip with Mom',use_column_width='always')

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

Additional information

If needed, add any other context about the problem here.

Hi @abhiadukia , thanks for submitting your issue and love all the photos in your app! Looks like a fun 2022 UK trip with your mom :slight_smile:

Are all your photos correctly upright? Can you just rotate all your images through an online tool such as Rotate image online or
use code?
How to rotate an image using Python? - GeeksforGeeks.

Hi,
I faced the same problem, the issue was that images taken with phone camera has an EXIF data field which often rotates images taken with the phone in a tilted position. PIL has a utility function that removes this data and ‘uprights’ the image.

from PIL import ImageOps

image = ImageOps.exif_transpose(image)

this solved the problem in my case.