Install
Install with PiG
pig install npm:pi-orca-imagesInstall with Pi
pi install npm:pi-orca-imagesPackages 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.
{
"image": "https://raw.githubusercontent.com/JlMoreno00/pi-orca-images/main/docs/before-after.png",
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.4.0 (README.md). PiG does not review it.
Inline images for the Pi coding agent inside Orca's terminal.
Pi draws images natively (screenshots it reads, image tool results, previews), but inside Orca you get a blank gap or Read image file [image/png] and nothing else. This package fixes that with no configuration, and adds OpenCode-style [Image 1] labels for pasted images.
pi install npm:pi-orca-images
Restart Pi in an Orca terminal and run /orca-images test. You should see a color gradient.
What it fixes
Orca renders inline images through xterm.js's image addon. Three things keep Pi's images from showing up there:
| Problem | Cause | What this package does |
|---|---|---|
| No images at all | Pi does not recognize TERM_PROGRAM=Orca and ignores the ORCA_IMAGE_PROTOCOL=kitty hint that Orca exports | Sets PI_IMAGE_PROTOCOL from ORCA_IMAGE_PROTOCOL at startup |
| Only the first row of an image is drawn | The addon stores Kitty images per cell, so Pi's later line writes erase the rest | Turns on Pi's "draw images last" render path (the one Pi already uses for WezTerm), only while Pi renders; the variable never reaches commands Pi runs |
| Images vanish after switching tabs | When output arrives while a pane is hidden, Orca rebuilds the pane from a snapshot that has no images (stablyai/orca#32714) | On focus-in, re-sends every visible image a few times over the next 5 seconds, until Orca's restore has finished |
Pasted image labels
Paste an image (or drop an image file) into Pi's prompt and the path is shown as a bold, colored [Image 1] label, as in OpenCode. Labels are numbered per message, move and delete as one unit, and become the real path again when you send the message, so the model sees exactly what it saw before.
Each label is also a link to its image file: Cmd-click [Image 1] to check what you pasted before sending it. In Orca this opens an image tab with zoom controls; other terminals open it if they support OSC 8 links (iTerm2, Ghostty, WezTerm, Kitty). In any terminal on macOS, /orca-images open 1 opens [Image 1] in Preview. It looks in the current prompt first, then in the last sent message that had labels, since typing the command replaces the prompt.
It recognizes pastes made only of existing image files (png, jpg, gif, webp, bmp, tiff, heic, avif): plain paths, ~/ paths, quoted or backslash-escaped paths, and file:// URLs. Text that mixes a path with other words is left alone. This works in every terminal, not only Orca, including Pi's own clipboard paste. Set PI_IMAGE_LABELS=0 to turn it off.
Pasted image preview
While the prompt has pasted images, a small thumbnail of one of them is shown above it, with a compact navigator legend below the thumbnail:
[Image 2] 2/3 · Ctrl+Shift+←/→
With a single pasted image the legend is just [Image 1]. The thumbnail has no Open image link; Cmd-click its [Image N] label in the prompt instead.
It shows the image you just pasted; moving the cursor onto an [Image N] label shows that one, and Ctrl+Shift+←/→ steps to the previous or next image. Only one thumbnail is drawn at a time, so the prompt stays in view and every terminal that draws Pi's images draws it the same way. The preview disappears when you send the message.
In terminals without inline images the legend follows a text line with the image type, size and file name. Set PI_IMAGE_PREVIEW=0 to turn the preview off; it is also off when PI_IMAGE_LABELS=0.
Open image previews
Each rendered image gets an Open image file link beneath it. Cmd-click the link on macOS to open the preview through your terminal. In our Orca test, this opens an Orca image tab with zoom controls. Direct image clicks and hover-to-zoom are not supported.
On macOS, /orca-images open opens the last image rendered by Pi in Preview, using open -a Preview.
Preview copies are saved in a private pi-orca-images-* directory under the OS temporary directory, never in the project. Identical images reuse a file within each loaded extension instance. Files survive /reload and are deleted on normal Pi process exit; links expire when their files are removed. Crashes or forced termination can leave files behind, and long-running sessions can still accumulate previews. Older .pi/image-previews/ folders are not automatically removed.
The saved bytes are those available to Pi and may already have been resized by a tool. Previews require automatic Orca detection and a writable temporary directory. They are inactive when PI_ORCA_IMAGES=0 or an explicit PI_IMAGE_PROTOCOL overrides detection. The link and Preview command were tested with Pi 1.5.2 on macOS; opening through the command requires macOS Preview.
Commands
| Command | Effect |
|---|---|
/orca-images or /orca-images status | Shows the detection decision, Pi's active image protocol, and whether the repaint fix, image labels and image preview are on |
/orca-images test | Draws a test gradient (it is not sent to the model) |
/orca-images open | Opens the last rendered image in macOS Preview |
/orca-images open N | Opens the pasted [Image N] in macOS Preview, from the prompt or the last sent message |
/orca-images redraw | Re-sends every visible image right now |
Configuration
The rendering fixes and preview links activate only in Orca; pasted image labels can work in any terminal. Your explicit choices always win:
| Setting | Effect |
|---|---|
PI_ORCA_IMAGES=0 | Disables the Orca image fixes and preview feature |
PI_IMAGE_LABELS=0 | Disables pasted image labels (and the preview above the prompt) |
PI_IMAGE_PREVIEW=0 | Disables the pasted image preview above the prompt |
PI_IMAGE_PROTOCOL=… | Used as is; the package does not override it |
terminal.images in Pi settings | Applied by Pi on top of the package's choice |
terminal.showImages: false | Pi still hides images |
Requirements and limits
- Orca with inline images (v1.4.229 or later exports
ORCA_IMAGE_PROTOCOL) and Settings → Terminal → Inline Images on (the default). - Pi 1.4 in its default
fullscreenTUI mode. Inregularmode detection still works, but the repaint fix and tab recovery do not apply. - Not inside tmux or screen: image escapes do not reach Orca through them.
- Image labels wrap internal methods of Pi's editor (
handlePaste,segment,expandPasteMarkers,render). If a Pi release changes them, pasted paths simply stay as paths. - The preview above the prompt reads the pasted file when it is shown; Ctrl+Shift+←/→ does nothing if your terminal or Pi keybindings already use those keys, but moving the cursor onto a label still switches the image.
- Preview links read internal fields of Pi's image component. If those fields change or preview copies cannot be saved, links are omitted.
- The repaint fix wraps two internal methods of Pi's TUI. If a Pi release renames them,
/orca-images statusreports the fix asunavailableand images fall back to the first-row behavior; detection keeps working.
Development
npm install
npm run check # typecheck + tests
pi -e ./src/index.ts # try it without installing
python3 scripts/banner.py # regenerate docs/banner.png (Pillow, Inter, JetBrains Mono)
The screenshots in docs/ are real captures of Pi 1.4 in Orca 1.4.229 on macOS.
License
MIT