← Catalog

@moguw/pi-image-preview

Show images above the Pi editor as you type a path, and attach them to your message

Extension

Install

Install with PiG

pig install npm:@moguw/pi-image-preview

Install with Pi

pi install npm:@moguw/pi-image-preview
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.0 (README.md). PiG does not review it.

@moguw/pi-image-preview

Show images above the editor as you type a path, and attach them to the message you send.

A UI extension, not a capability one. Recent models see images natively, so this adds nothing about how images are understood — it removes the friction of getting them in front of you while you type.

What it does

Type a path to an image in the editor. Three hundred milliseconds after you stop typing, the image appears above the editor with a metadata line. Send the message and the same bytes are attached, with the path replaced by a numbered marker.

┌──────────────────────────────────┐
│  (image)                         │   ← preview, above the editor
│  shot.png | 1080x2400 | ... | 2KB│
├──────────────────────────────────┤
│ compare `[Image-#1]` with the …  │   ← what you typed, path replaced
└──────────────────────────────────┘

Both axes of the preview are bounded. A tall screenshot is limited by height and shrinks; it does not push the editor off screen.

What it deliberately does not do

Pi already handles the rest, and a second copy of that logic would only disagree with the first:

Not hereBecause
Resizing or format conversionPi normalizes every attachment against the active model's limits before sending
Checking whether the model takes imagesPi reports its own note when the model cannot, and omits the image
Delegating to a second vision modelThe reason to attach natively is that the primary model can see the image
Caching, retries, fallbacksNothing is being called
A separate "look at this image" commandThe preview already shows what such a command would
ConfigurationThere is nothing worth choosing

Install

pi install npm:@moguw/pi-image-preview

Path detection

A token is only treated as an image when it has a path separator and ends in a supported extension, so screenshot.png in prose stays prose:

/tmp/shot.png     ~/Pictures/a.jpg     ./out.png     ../up/b.webp

Spaces are supported in the form a terminal produces when you drag a file in (/tmp/Screen\ Shot.png). Supported: png, jpg, jpeg, gif, webp, bmp.

Terminal support

Image rendering is Pi TUI's own, so it follows the terminal:

TerminalRendering
Kitty, Ghostty, WezTerm, iTerm2 (standalone)Real graphics
tmux, VS Code, Alacritty, othersText fallback: the metadata line still appears

The fallback is honest: you see name, dimensions, format, and size, and know the image was found.

Licence

MIT. The preview component is derived from @getpipher/vision by RECTOR, also MIT.