Streamlit image

Hey guys , is it possible to resize st.image’s height too ?


When you resize the width, the height will automatically adjust to keep the image proportional – so you can resize the height by just resizing the width.


1 Like

Hey @Caroline ,
exactly , but I want to adjust the aspect-ratio so that the image is 16:9 , is there a way to do that ?
Thank you

Hi @AYMEN_GADRI - you can use w, h = from the PIL package to then compute the correct width for a 16:9 aspect ratio, which you pass to st.image.



hey @asehmi ,
Thank you , that’s what I did and it worked .
Thank you guys

1 Like