Take a screenshot of a SceneView

This sample shows how to use the SceneView.takeScreenshot() method to create an image of the current view. The method returns a promise that resolves with a Screenshot object that contains the raw ImageData and the image as a data url. In this sample we add the image data to a canvas so that we can add a custom text on top of it.

Several options can be passed into the method.

The image format can be jpg or png. If the format is jpg you can also set the quality parameter.

1
2
3
4
view.takeScreenshot({
  format: "jpg",
  quality: 70
});

The image can be scaled up or down, by setting the width or the height of the image:

1
2
3
4
5
view.takeScreenshot({
  // scale down image to 50%
  // height is calculated from aspect ratio of the view
  width: view.width / 2
});

Sometimes it is useful to create an image of an area of the view. In this case we can use the area parameter to only take a screenshot of a section of the screen:

1
2
3
4
5
6
7
8
view.takeScreenshot({
  area: {
    x: 0,
    y: 0,
    width: 100,
    height: 100
  }
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close