Skip to content

Save threejs 3D graphics as png using pyppeteer #33534

@mkoeppe

Description

@mkoeppe

... in src/sage/plot/plot3d/base.pyx (_save_image_png)

From https://github.com/plotly/Kaleido#background:

programmatically generating [...] PNGs [...] from web-based visualization libraries (e.g. Plotly.js, Vega-Lite, etc.) is a complex problem. [...] The core difficulty is that web-based visualization libraries don't actually render plots (i.e. color the pixels) on their own, instead they [...] rely on a web browser rendering engine to display figures.

When the figure is displayed in a browser window, it's relatively straight-forward [...] to provide an export-image button because it has full access to the browser for rendering. [...] to export an image programmatically (e.g. from Python) without displaying it in a browser and without user interaction [...], the Python portion of the visualization library needs programmatic access to a web browser's rendering engine.

There are at least two options:

References:

Depends on #33533

CC: @egourgoulhon @kwankyu

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/33534

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions