home / skills / sarfraznawaz2005 / agent-skills-collection / take-screenshots

take-screenshots skill

/take-screenshots

This skill captures full-screen or region screenshots on Windows with configurable JPEG quality and scaling to reduce file sizes.

npx playbooks add skill sarfraznawaz2005/agent-skills-collection --skill take-screenshots

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
3.4 KB
---
name: take-screenshots
description: A Windows screenshot skill that provides both programmatic full-screen capture and interactive region selection.
license: ""
compatibility: opencode
---

# take-screenshots

## Purpose

RegionSnip is a Windows screenshot capture utility written in C# that provides both programmatic full-screen capture and interactive region selection. It supports JPEG formats, with options for quality compression and image scaling to optimize file size.

## Usage

RegionSnip is designed to be called programmatically and outputs JSON results to stdout.

### Command Line Arguments

| Argument | Description | Example |
|----------|-------------|---------|
| `--mode <mode>` | Capture mode: `full` or `region` (default: region) | `--mode full` |
| `--out <path>` | Output file path (required). Use `.jpg` or `.jpeg` for JPEG compression. | `--out screenshot.jpg` |
| `--all` | Capture all monitors (full mode only) | `--all` |
| `--monitor <n>` | Specific monitor index (0-based, full mode only) | `--monitor 1` |
| `--prompt <text>` | Custom prompt text for region selection | `--prompt "Select area"` |
| `--quality <n>` | JPEG quality level (1-100, default: 80) | `--quality 75` |
| `--scale <n>` | Image scaling factor (0.1-1.0, default: 0.75 for full, 1.0 for region) | `--scale 0.5` |

### Examples

#### Full-screen capture of primary monitor:
```bash
./scripts/RegionSnip.exe --mode full --out screenshot.jpg
```

#### Full-screen capture of all monitors:
```bash
./scripts/RegionSnip.exe --mode full --out screenshot.jpg --all
```

#### Full-screen capture of specific monitor:
```bash
./scripts/RegionSnip.exe --mode full --out screenshot.jpg --monitor 1
```

#### Interactive region selection:
```bash
./scripts/RegionSnip.exe --mode region --out screenshot.jpg
```

#### Interactive region selection with custom prompt:
```bash
./scripts/RegionSnip.exe --mode region --out screenshot.jpg --prompt "Drag to select the area to capture"
```

#### Optimized Capture Prefered (JPEG + Scaling):
To significantly reduce file size (e.g., for sending to LLMs), use `.jpg` extension along with quality and scale parameters.

```bash
# Reduces size by using JPEG compression (80%) and scaling down to 50%
./scripts/RegionSnip.exe --mode full --out screenshot.jpg --quality 80 --scale 0.5
```

## Output Format

RegionSnip outputs JSON to stdout with the following structure:

### Success Response (Full Mode):
```json
{
  "ok": true,
  "path": "screenshot.jpg",
  "mode": "full",
  "monitorIndex": 0,
  "all": false,
  "rect": {
    "x": 0,
    "y": 0,
    "width": 1920,
    "height": 1080
  },
  "width": 1920,
  "height": 1080
}
```

### Success Response (Region Mode):
```json
{
  "ok": true,
  "path": "screenshot.jpg",
  "mode": "region",
  "rect": {
    "x": 100,
    "y": 100,
    "width": 800,
    "height": 600
  },
  "width": 800,
  "height": 600
}
```

### Error Response:
```json
{
  "ok": false,
  "error": "Description of what went wrong",
  "mode": "region"
}
```

### Cancellation Response (Region Mode):
```json
{
  "ok": false,
  "cancelled": true,
  "mode": "region"
}
```

## Error Handling

- Always check the `ok` field in the response
- For region selection, users can cancel the operation (results in `cancelled: true`)
- Common errors include invalid monitor indices, permission issues, or timeout
- Screenshots are saved as JPEG files to the specified path
- Base64 image data is included when `includeImage=true` for further processing

Overview

This skill provides Windows screenshot capture with both programmatic full-screen grabs and interactive region selection. It saves JPEG output with configurable quality and scaling to reduce file size. The tool returns structured JSON to stdout so calling processes can parse results or errors programmatically.

How this skill works

You invoke the executable with command-line flags to choose mode (full or region), output path, and optional parameters like monitor index, quality, and scale. In full mode it captures one or all monitors; in region mode it displays an interactive selector and returns coordinates. The program writes a JSON success, error, or cancellation object to stdout and saves the image file to the provided path.

When to use it

  • Capture an entire monitor or all monitors for full-screen diagnostics or documentation.
  • Select a precise screen region for bug reports, UI snippets, or focused screenshots.
  • Reduce image size before sending to models or over networks using JPEG quality and scale parameters.
  • Automate screenshots from scripts or tools needing JSON output and consistent file paths.
  • Collect screen evidence during automated workflows while recording monitor index and rectangle coordinates.

Best practices

  • Always specify --out with a .jpg/.jpeg filename when you want compression; otherwise use lossless formats if available.
  • Set --quality (1–100) and --scale (0.1–1.0) to balance visual fidelity and file size for downstream processing.
  • Check the JSON response's ok field before using the saved file; handle cancelled: true for region mode.
  • Use --monitor or --all explicitly in full mode to avoid ambiguous captures on multi-monitor systems.
  • Provide a clear --prompt string in region mode to guide users during interactive selection.

Example use cases

  • Automated nightly capture of the primary display for visual regression testing: --mode full --monitor 0 --out nightly.jpg --quality 80 --scale 0.5.
  • Manual bug reporting: run region mode with a custom prompt to capture the offending UI element and attach coordinates from the JSON output.
  • Send lightweight screenshots to an LLM by scaling to 0.5 and using JPEG quality 75 to reduce upload size.
  • Capture all connected displays for multi-monitor troubleshooting with --mode full --all --out multi.jpg.
  • Embed screenshot capture into a diagnostic script that parses JSON to record width, height, and monitorIndex for each capture.

FAQ

What does the tool output after a successful capture?

It prints a JSON object with ok:true plus path, mode, rect, width, and height; full mode also includes monitorIndex and all flags.

How do I reduce file size for model uploads?

Use a .jpg filename, set --quality to a lower value (e.g., 75) and --scale to a value below 1.0 (e.g., 0.5).

What happens if a user cancels region selection?

The tool writes a JSON object with ok:false and cancelled:true for region mode; handle this case in calling code.

What are common errors to handle?

Invalid monitor indices, permission or write errors for the output path, and timeouts during interactive selection; always check the ok and error fields.