@moguw/pi-image-preview

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

Packages

Package details

extension

Install @moguw/pi-image-preview from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@moguw/pi-image-preview
Package
@moguw/pi-image-preview
Version
0.1.0
Published
Oct 31, 2026
Downloads
232/mo · 232/wk
Author
moguw
License
MIT
Types
extension
Size
18.3 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@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 here Because
Resizing or format conversion Pi normalizes every attachment against the active model's limits before sending
Checking whether the model takes images Pi reports its own note when the model cannot, and omits the image
Delegating to a second vision model The reason to attach natively is that the primary model can see the image
Caching, retries, fallbacks Nothing is being called
A separate "look at this image" command The preview already shows what such a command would
Configuration There 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:

Terminal Rendering
Kitty, Ghostty, WezTerm, iTerm2 (standalone) Real graphics
tmux, VS Code, Alacritty, others Text 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.