Camera "snapshot" of a complex 3D scene?

Is there a way for Plotly to construct a static 2D image that is a camera snapshot of a complex 3D scene?

I have geometric data sets that Plotly renders beautifully. However, it only works on small examples like tens of MB of generated HTML. Most examples are much bigger than that and when I try to render a full instance, all the browsers that I’ve tried fail to finish loading the Plotly output. When the generated HTML is a few megabytes, it’s fine. When it’s 50+MB, Safari can still render it, but Chrome cannot. When it’s 500MB+ or a few GB of generated svg/webgl awesomeness, then it seems there’s no hope for viewing it…

Unless there’s a way to compute camera snapshots?

I see how to do something like this with numpy arrays and perspective transformations on the underlying data. However, what I really want is Plotly’s beautiful rendering of lines in a 3D scene. While my underlying data has points, they are connected, and the topology of the connectedness is an essential feature for viewing. Plotly’s line graphs do a nice job showing this connectedness, so what I’d really like to have is the camera’s 2D view matrix as a snapshot image.

Ideally, this would be available in Python. I’ve thought about trying to extract it from Javascript, but I think that requires a browser that doesn’t give up on loading a large file. If Plotly’s camera computations happen only in Javascript, then maybe there’s a way to run them in v8 on the command line and extract just the matrix of the camera view, and then render that into a PNG file?

Thank you for any guidance.

Hi @ttst your topic sounds interesting, could you add some images to understand better what you are trying to achieve?

Sure! Thanks for asking. Here’s a small screenshot.

My question is equivalent to this: can Plotly generate a screenshot PNG of what it would show in the browser without using a browser? (Because the browser can’t handle it.)

So you want to generate the figure but never show it and create a png file instead? Once you created the figure you could try


This requires kaleido to be installed, though.

pip install -U kaleido

wow wow wow. Plotly is just sooo cool.

this works:

    png_img =, 'png')
    fname = 'test.png'
    with open(fname, 'wb') as fh:


1 Like

Glad you figured it out!