export cesium image to png or jpg - screenshot

1,798 views
Skip to first unread message

Luiz Arlindo Kohler

unread,
Dec 18, 2014, 8:52:08 AM12/18/14
to cesiu...@googlegroups.com
I need to generate an image to my app with images of cesium and objects (lines, polygons and points), but looking at the Forums new found no function like. I've tried viewer.canvas.toDataUrl but appears only a black image.

How do I take a screenshot of cesium? Or how do I export an image of type png or jpeg of a desired area?

Matthew Amato

unread,
Dec 18, 2014, 9:49:20 AM12/18/14
to cesiu...@googlegroups.com
You need to call viewer.render() immediately before toDataUrl in order to guarantee their is a scene on the canvas.

viewer.render();
viewer.canvas.toDataUrl();

On Thu, Dec 18, 2014 at 8:52 AM, Luiz Arlindo Kohler <luiz.arl...@gmail.com> wrote:
I need to generate an image to my app with images of cesium and objects (lines, polygons and points), but looking at the Forums new found no function like. I've tried viewer.canvas.toDataUrl but appears only a black image.

How do I take a screenshot of cesium? Or how do I export an image of type png or jpeg of a desired area?

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Luiz Arlindo Kohler

unread,
Dec 19, 2014, 2:31:36 PM12/19/14
to cesiu...@googlegroups.com
thank

 it's worked !!!!
Reply all
Reply to author
Forward
0 new messages