---
title: screenshot
slug: develop/screenshot
docTags: 
createdAt: 2025-03-26T14:48:41.185Z
---

The *screenshot&#xA0;*&#x6F;bject allows you to capture a screenshot of the composite video and graphics layers.

**screenshot IDL**

```javascript
interface Screenshot {                                                                                                                                                                                                                                                  
    void syncCapture(ScreenshotParams params);                                                                                                                                                                                                                          
    Promise<void> asyncCapture(ScreenshotParams params);                                                                                                                                                                                                                
};                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                        
interface ScreenshotParams {                                                                                                                                                                                                                                            
    [optional] attribute String destinationFileName;                                                                                                                                                                                                                    
    [optional] attribute String fileName;                                                                                                                                                                                                                               
    [optional, Default=JPEG] attribute String fileType;                                                                                                                                                                                                                 
    [optional, Default=""] attribute String description;                                                                                                                                                                                                                
    [optional, Default=640] attribute int width;                                                                                                                                                                                                                        
    [optional, Default=480] attribute int height;                                                                                                                                                                                                                       
    [optional, Default=50] attribute int quality;                                                                                                                                                                                                                       
    [optional, Default=0] attribute int rotation;                                                                                                                                                                                                                       
};  
```

## Object Creation

To create a *screenshot* object, first load the `brightsign/screenshot` module using the `require()` method. Then create an instance of the *screenshot* class.

```javascript
var ScreenshotClass = require("@brightsign/screenshot");
var screenshot = new ScreenshotClass();
```

## Screenshot

Use this interface to take screenshots.

**syncCapture()**

```javascript
void syncCapture(ScreenshotParams params) 
```

Takes a screenshot at nearly the exact moment that it is called. Because this method might interrupt on-screen operations, it is more appropriate for debugging applications.

**asyncCapture()**

```javascript
Promise<void> asyncCapture(ScreenshotParams params)
```

Takes a screenshot without interrupting other operations. This method is appropriate for production environments–where the timing of the capture is less important than seamless operation.

## ScreenshotParams

This interface contains screenshot settings.

- `destinationFileName` <font color="#6554c0">string</font>: The native path and filename that will be saved (for example, *storage/sd/myscreenshots/screen.jpg*). If the specified directory does not exist, the screenshot will fail.
- `fileName` <font color="#6554c0">string</font>:  The name and path of the image file that will be saved (e.g. "SD:/myscreenshots/screen.jpg"). If the specified directory does not exist, the screenshot will fail. This is deprecated in favor of `destinationFileName`, but is still supported. 
- `fileType` <font color="#6554c0">string</font>: The file type of the image ("JPEG" or "BMP"). The default file type is "JPEG". Note that the file extension (".jpg" or ".bmp") is not appended to the filename by default and, if needed, should be included in the `fileName` string.
- `description` <font color="#6554c0">string </font><font color="#01a0af">optional</font>: An optional description.
- `width` <font color="#6554c0">int</font>: The width of the image file. The default value is 640.
- `height` <font color="#6554c0">int</font>: The height of the image file. The default value is 480.
- `quality`<font color="#6554c0"> int</font>: The image quality of the screenshot (between 0 and 100). The default value is 50.
- `rotation` <font color="#6554c0">int</font>: The rotation of the screenshot image (in degrees). The default value is 0. Accepted values are 0, 90, 180, and 270.

## Example

This script takes a screenshot asynchronously every five minutes, saving it to the root of the SD card. Note that the previous image is erased with each new screenshot.

```javascript
var ScreenshotClass = require("@brightsign/screenshot");
var screenshot = new ScreenshotClass();

function takeAsyncScreenshot(args) {
    screenshot.asyncCapture(args).then().catch();
};

screenshotParams = {};
screenshotParams.fileName = "SD:/screen.jpg";
screenshotParams.quality = 75;

setInterval(takeAsyncScreenshot(screenshotParams), 10000);
```

