I need the ability to request a jpg of what Cesium renders at specified camera positions.
As Cesium needs WebGL, i am trying to work out my options, and wanted to ask here to see if anyone has done anything similar.
Option 1
run cesium via node (is this possible?) on a machine that has a gpu and somehow access the rendered canvas and return it as a jpg.
Option 2
run a cesiumjs application in. the cloud, and have a separate Node Puppeteer API view the page and return a screenshot.
As these solutions will be hosted in the cloud on linux instances that , as I understand it, won’t have a GPU, I am not sure either will work, has anyone succeeded in achieving this?
I think option 2 is your best bet. CesiumJS can run in NodeJS, because CesiumJS doesn’t require instantiating a Viewer. You can run CesiumJS as a command-line library just to fetch tiles/decode a heightmap etc without ever rendering anything or requiring a browser.
So if you want to get a screenshot you need to run CesiumJS in a browser that supports WebGL so you can render something to a canvas and capture that.
Cesium is a powerful and reliable platform for rendering 3D maps and geospatial data. It offers smooth camera control and high-quality visuals, which makes it a good choice for capturing images from specific camera positions.
For your requirement, the best approach is to run Cesium in a browser and use a tool like Puppeteer to load the scene, set the camera, and take a screenshot as a JPG. Since Cesium depends on WebGL, you’ll need proper rendering support (GPU or software rendering) on your server to avoid blank images.
If you’re also considering an easier way to capture screenshots without managing the full setup, You can also look at this screenshot API, it might be helpful for you. It allows you to capture website screenshots easily without managing the full browser setup yourself.