Plotly_chart cannot display large imshow

Hi,

I am trying to display an image with plotly_chart on my streamlit app that is running locally.
The user inputs change the size of the image and for certain parameters the image won’t be displayed anymore.

I think that it is link to the size of the image and to test that I made a simple demonstrator of the problem:

import streamlit as st
import plotly.express as px
import numpy as np

def main() -> None:
    st.set_page_config(layout="wide")
    st.title("Test imshow")

    st.write("Test of displaying an image using plotly in streamlit.")
    x = st.number_input("x", 10, 10000, 100)
    y = st.number_input("y", 10, 10000, 100)
    image = np.random.random((x, y))

    plot = st.empty()

    im = px.imshow(image, aspect='auto')
    with plot:
        st.plotly_chart(im)

When I choose x = 2000 and y > 1400 (more or less), the image is no longer displayed (no error message, just “:”).
I’ve tried increasing the maximum message or file size to 500 MB, 1 GB or more, but it doesn’t make any difference.
I’ve tried changing these settings in the streamlit code, with or without a reboot, nothing changes.

I’ve seen several old posts on this subject but in the end none of them helped me.

If you can give me a hand, thank you!

Hi @Xan, welcome to the forum!

For me, I’m able to see an image up to about 3000 x 3000

, but if it gets much better than that, I get the MaxMessageSize error

Do you see any errors in the browser’s developer console when it simply doesn’t show?

Also, what versions of streamlit, python, and browser are you using?

Thank you, so I guess its an issue with my setup…

I have indeed some errors in the console but I don’t understand what they mean apart from “out of memory”:

Streamlit: v1.39.0
Plotly : v5.24.1
python : v3.10
Mozilla : v130.0 (32 bits)

Edit:
I tried with an other browser and it works ! So its probably an issue with Mozilla, or this version of Mozilla.
As I am on a company’s computer I cannot change it but anyway, thank you for you help.

1 Like

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