# Windows Screenshot for Raycast

URL: https://www.raycast.com/afaan_mushtaq/windows-screenshot

> Take screenshots on Windows 10 and 11: capture the full screen, a window or a region, and extract text from images with local Windows OCR.

- Install: raycast://extensions/afaan_mushtaq/windows-screenshot
- Author: [Afaan Mushtaq](https://www.raycast.com/afaan_mushtaq)
- Installs: 135
- Platforms: Windows
- Categories: Applications, Media, System
- Updated: 2026-11-17
- Source: https://github.com/raycast/extensions/tree/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot/

## Commands

- **Capture Screen**: Capture a screenshot of the entire screen
- **Capture Window**: Select and capture a window
- **Capture Region**: Select an area of the screen to capture
- **Extract Text**: Extract text from an image using native local Windows OCR and copy to clipboard

## README

### Windows Screenshot Raycast Extension

A Windows-native screenshot extension for [Raycast](https://www.raycast.com), providing fast, keyboard-driven screen capture capabilities on Windows 10 and 11.

![Extension Icon](https://github.com/raycast/extensions/raw/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot//icon.png)

#### Features

- **Capture Screen**: Instantly captures the entire screen across single or multi-monitor setups.
- **Capture Region**: Interactive full-screen selection overlay with real-time dimension indicators (`W × H px`), blue selection border, and `ESC` or right-click cancellation.
- **Capture Window**: Interactively select and capture any application window with real-time hover highlight and DWM frame precision, excluding invisible drop-shadow margins.
- **Extract Text (OCR)**: Native Windows WinRT OCR engine extracts text locally and offline from screen captures or image files directly into your clipboard.
- **Flexible Output**: Configure output to Save to disk, Copy image directly to the clipboard, or both simultaneously (`Save + Copy`).
- **High-DPI & Multi-Monitor**: Fully DPI-aware coordinate calculation matching actual screen resolution.
- **Zero External Dependencies**: Powered natively by Windows GDI32, Win32 APIs, WinRT OCR, and .NET Framework built into Windows.

---

#### Commands

| Command | Description | Mode |
| :--- | :--- | :--- |
| **Capture Screen** | Capture a screenshot of the entire screen | `no-view` |
| **Capture Region** | Select a rectangular area of the screen to capture | `no-view` |
| **Capture Window** | Select and capture an application window | `no-view` |
| **Extract Text** | Extract text from an image or screenshot using local Windows OCR | `view` |

---

#### Preferences

You can customize the extension behavior in Raycast Preferences (`Cmd/Ctrl + ,`):

| Preference | Type | Default | Options / Details |
| :--- | :--- | :--- | :--- |
| **Screenshot Output** | Dropdown | `Save + Copy` | `Save + Copy`, `Save`, `Copy` |
| **Screenshot Save Location** | Directory | `~/Pictures/Screenshots` | Directory path to save image files |

##### Save Location Path Expansion

The save location supports standard Windows path conventions:
- Tilde expansion: `~/Pictures/Screenshots`
- Environment variables: `%USERPROFILE%\Pictures\Screenshots`
- Custom absolute paths: `C:\Users\YourName\Desktop`

If the destination directory does not exist, it will be created automatically.

##### File Naming Convention

Screenshots are saved using the timestamp format:

```text
Screenshot YYYY-MM-DD HH-mm-ss.png
```

*Example:* `Screenshot 2026-08-11 13-42-18.png`

If a file collision occurs, unique index suffixes are automatically appended (e.g. `Screenshot 2026-08-11 13-42-18 (1).png`).

---

#### Technical Architecture

This extension uses a native Windows execution engine:

- **GDI32 BitBlt & User32**: Used for pixel-perfect frame grabbing from screen device contexts (`GetDC`, `BitBlt`).
- **Desktop Window Manager (DWM)**: `DwmGetWindowAttribute` with `DWMWA_EXTENDED_FRAME_BOUNDS` is used to capture visible window bounds cleanly without transparent shadow margins.
- **WinForms Overlay Engine**: Interactive region capture utilizes a borderless full-screen form showing a pre-captured desktop image with a dimmed translucent mask (`Color.FromArgb(120, 0, 0, 0)`), blue bounding box, and dimensions badge.
- **Windows Clipboard (`System.Windows.Forms.Clipboard`)**: Writes native DIB/Bitmap image data directly to the clipboard, making it instantly pastable into applications like Paint, Discord, Slack, Photoshop, and web forms.

---

#### Development & Contribution

##### Prerequisites

- Node.js (v18 or higher)
- Raycast for Windows

##### Build & Test Commands

```bash
# Install dependencies
npm install

# Start extension in development mode
npm run dev

# Lint source code & metadata
npm run lint

# Build production bundle
npm run build

# Recompile native binaries from C# sources (Windows)
npm run build:binaries
```

---

#### Native Binaries & Build Provenance

This extension bundles two native helper binaries in `assets/bin/` to provide sub-20ms instant capture and local OCR without runtime compilation overhead:

- `CaptureEngine.dll`: Compiled from [`assets/scripts/capture.cs`](https://github.com/raycast/extensions/raw/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot//assets/scripts/capture.cs) (Win32/GDI32/WinForms capture engine).
- `ocr.exe`: Compiled from [`assets/scripts/ocr.cs`](https://github.com/raycast/extensions/raw/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot//assets/scripts/ocr.cs) (Windows WinRT OCR CLI).

##### Reproducible Builds

Both binaries are compiled deterministically using standard Microsoft .NET Framework C# compiler (`csc.exe`) built into Windows. You can inspect the source code and rebuild them at any time:

```bash
npm run build:binaries
# or: powershell -NoProfile -ExecutionPolicy Bypass -File assets/scripts/build.ps1
```

For complete compiler flags, referenced assemblies, and SHA-256 checksums, see [`assets/bin/README.md`](https://github.com/raycast/extensions/raw/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot//assets/bin/README.md).

> **Graceful Fallback**: If the binaries are absent or removed, the extension automatically falls back to executing the C# sources dynamically via PowerShell (`capture.ps1` and `ocr.ps1`).

---

#### License

[MIT](https://github.com/raycast/extensions/raw/886cbd73fe377ad1d8f0c17083e6cd4c96748a33/extensions/windows-screenshot//LICENSE)
