# Render a Preview

You might write a controller that needs to show what a title will look like with certain variable settings before going live with it.

The “[snapshot](/captivate-api/all-commands-reference/status-information.md#api-command-getsnapshot)” command does just that. With it, you can set variables and request a preview rendering.

This example shows how to use the snapshot command to preview:

```javascript
scheduler.scheduleCommand(
  'getSnapshot',
  { input: inputName, encode: 1, scaleToFit: 1, width: 800, height: 300, sync: 1 },
  settings.variables,
  (resultString) => {
    console.log(resultString);
  }
);
```

| Parameter            | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `encode`             | tells snapshot to return the png image as a byte-encoded string.                                                                               |
| `width` and `height` | set the size of the returned image.                                                                                                            |
| `scaleToFit`         | tells it to scale the image so it best fits the width and height, while maintaining the correct aspect ratio.                                  |
| `sync`               | tells snapshot to perform the work synchronously and return the data in the callback, otherwise, the data will come in a notification message. |

And then, once you like what you see, safely update the live title using the `scheduleAction` command:

```javascript
scheduler.scheduleAction('update', inputName, '', settings.variables);
```

<figure><img src="/files/kC1HCSoxmIjmhheGbDRJ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.newbluefx.com/api-examples/sample-controllers-tour/04-render-a-preview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
