Skip to content
Back to skills

Save A Screenshot

ASecurity

Capture the rendered frame as a PNG - download it, or get a Blob to use yourself.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
developmentbackend

Works with

  • cli

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add blit386/blit386 --skill save-a-screenshot --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Save A Screenshot?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Save A Screenshot
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blit386-save-a-screenshot/badge)](https://www.skillsdirectory.com/skills/blit386-save-a-screenshot)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: save-a-screenshot
description:
  Capture the rendered frame as a PNG, either downloading it or getting a Blob. Use for a screenshot button, a 'share my
  creation' feature, or exporting generated pixel art.
---

# Save a screenshot

Capture the rendered frame as a PNG - download it, or get a Blob to use yourself.

## Download a PNG

```js
update() {
    if (BT.isKeyPressed('KeyP')) {
        void BT.downloadFrame('my-art.png'); // prompts a browser download; filename optional
    }
}
```

## Get a Blob (upload, preview, store)

```js
async takeShot() {
    const blob = await BT.captureFrame(); // a PNG Blob, after the next render
    const url = URL.createObjectURL(blob);
    this.previewUrl = url;
}
```

## Get an exact 1:1 frame (tests, agents, pixel art) - engine 1.7.1+

By default the PNG matches `BT.outputSize`, which for a game with no `configure()` is `640x480` - every game pixel a 2x2
block, plus any display-tier effects (scanlines, vignette). For the game's real pixels, one PNG pixel per logical pixel
at `BT.displaySize`, pass `{ size: 'display' }`:

```js
const exact = await BT.captureFrame({ size: 'display' }); // 320x240 for the default game
await BT.downloadFrame('exact.png', { size: 'display' });
```

Use this whenever you compare frames or read pixels: the PNG always matches `BT.displaySize` (whatever
`drawingBufferSize` is set to), and the capture never collides with someone pressing F9 in the same frame. It leaves out
display-tier effects, since those only exist in the upscaled buffer.

## Capture the frame at a given time (engine 1.8.0+)

To screenshot what the game shows at second 3.2 - for a thumbnail, a test, or to check an animation - stop the game on
that frame with `BT.renderAt(3.2)`, then `captureFrame`. The `test-the-game` skill shows the whole sequence and what the
game must do for the frame to come out the same every time.

## The built-in dev shortcut (engine 1.7.0+)

While `{{pmRunDev}}` is running, you do not need any code to grab a frame:

- **F9** - copy the current frame to the clipboard, ready to paste into a chat or an issue.
- **Shift+F9** - save it as a PNG, named with the date and time so repeated presses never overwrite each other.

Both are dev-only: they follow `BT.isDevMode`, so a built game never binds them. If your game wants F9 for itself, turn
them off in `configure()`:

```js
configure() {
    return {
        isFrameCaptureShortcutEnabled: false, // F9 and Shift+F9 are mine now
    };
}
```

Setting the flag wins in both directions - `true` keeps the shortcuts in a release build too. Leave it unset and dev
mode decides. Either way, this is for you while you work; a screenshot _button_ your players can press is still the
`BT.downloadFrame` / `BT.captureFrame` code above.

## Key calls

- `BT.downloadFrame(filename?, options?)` (method, async) - capture and download.
- `BT.captureFrame(options?)` (method, async) - resolve to a PNG `Blob`.
- `{ size: 'display' }` (options, engine 1.7.1+) - capture at logical `BT.displaySize` instead of `BT.outputSize`.
- `BT.renderAt(seconds, { from }?)` / `BT.resume()` (methods, async, engine 1.8.0+) - stop on an exact frame, then play
  on; see the `test-the-game` skill.
- `isFrameCaptureShortcutEnabled` (configure flag, engine 1.7.0+) - force the F9 / Shift+F9 shortcuts on or off.

## Notes

- Both are async: `await` them in an async helper, or start them with `void` from `update()`. Keep `update()` itself
  plain, not `async` - the engine never waits for it.
- Capture happens after the next frame renders, so the latest draw is included.
- Works on both the WebGPU and software backends.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.