St.image() unable to open image from my pc

Hello streamlit community, am having some problem trying to use the st.image() to open an image saved on my local disk. below is the code

The pic fails to open when i run the script. Anyone who knows how to solve it?

Have you tried a variation of these:

st.image("c:\\U\\d\\Desktop\\logo.png", use_column_width=True)
st.image("c:/U/d/Desktop/logo.png", use_column_width=True)

If this doesn’t work, try using Pillow to handle the image before passing it to st.image:

import streamlit as st
from PIL import Image

# Open the image from the specified path
image ='c:/U/d/Desktop/logo.png')

# Display the image with a caption in Streamlit
st.image(image, caption='My logo')

using PIL worked but changing to double or forward slash didn’t

1 Like

Ah great, glad it worked eventually. Happy Streamlit-ing!:balloon:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.