I have the following code:

bottom_image = st.file_uploader('', type='jpg', key=6) if bottom_image is not None: st.image(bottom_image) 

the problem I run into is some of the images are very large and I want to be able to size them to a fixed size.

Not sure if this makes a difference or not, but the file_uploader is in a column.

I looked at creating a thumbnail but I could not figure that out.

Thoughts?

1 Answer

You can adjust the width parameter.

st.image(bottom_image, width=400) 

Or you can use the Pillow lib to manipulate the width and height.

from PIL import Image bottom_image = st.file_uploader('', type='jpg', key=6) if bottom_image is not None: image = Image.open(bottom_image) new_image = image.resize((600, 400)) st.image(new_image) 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.