Inserting image at side bar

Is there a way to insert image at sidebar? Maybe below the sidebar title?

You can use st.sidebar.image:

st.sidebar.image("/home/rzwitch/Downloads/randy-streamlit.png", use_column_width=True)

1 Like

@randyzwitch thx mate, gonna try this maybe today. If something goes wrong i come back here.

Hiya, This doesnโ€™t seem to work for some reason! Can you please help?

Capture

@vigneshjayanth00 could you please pass a snipp of you code?

Hi Felipe,

I used the same code shared above.

st.sidebar.image(rโ€™C:\Users\Home\Pictures\sample.pngโ€™, use_column_width=True)

My OS is windows! The image doesnโ€™t show as shown above

@vigneshjayanth00
maybe there are a problem in the directory you are passing. Check where you image is!

@vigneshjayanth00 I used
from PIL import Image

with st.sidebar.container():
image = Image.open(โ€˜path of imageโ€™)
st.image(image, width= use_column_width=True)

I am having a similar problem. Your solution works great, but puts the image below the list of pages. Is there any way to add it on top of the sidebar?

streamlit-extras has a component for that: โ€œApp logoโ€ :slight_smile:

2 Likes

Wow, thanks a lot for this hint!