Hide Fullscreen Option when displaying images using st.image

Hi,
I would like to remove the full screen option from displaying images.

I’m visualizing images from a URL using streamlit columns.
I create my four columns and display images as so

cols = st.columns(4)
cols[0].image(image['url'], use_column_width = True)

However, for each image I end up with this full screen option on the top right of the image, is there a way to get rid of it?
image

1 Like

Hi @AditSanghvi94 ,

Here’s an example, using the CSS part, you can hide the full screen option within the image.

import streamlit as st
url = "https://badgen.net/badge/icon/GitHub?icon=github&label"
st.image(url)

hide_img_fs = '''
<style>
button[title="View fullscreen"]{
    visibility: hidden;}
</style>
'''

st.markdown(hide_img_fs, unsafe_allow_html=True)

Will this help ?

Best,
Avra

5 Likes

Super nice solution @AvratanuBiswas - it is possible to set it specifically to some instances of st.image() and not all?

2 Likes

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