@tklu/pi-inline-images0.4.0
Display local PNG and JPEG images inline in Pi conversations with project-local copies for replay.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-inline-images
See local images inside your Pi conversation—and keep them there when you reopen it.
A small Pi extension that displays PNG and JPEG files inline, saves a copy in the conversation's project folder, and restores the preview from the saved reference. No separate image viewer required.
Experimental · Windows-tested. Display, scrolling, terminal resizing and restoration after restarting Pi have been verified by the author in Windows Terminal. macOS/iTerm2 is implemented but untested. Use Pi's regular terminal mode; fullscreen remains unverified.
What it does
- Adds a
show_imagetool for local PNG and JPEG files, with optional captions. - Displays previews inline with the surrounding conversation.
- Saves unchanged copies under the starting folder's
__images__/directory. - Restores saved previews without asking the model to regenerate the image.
- Leaves original source files untouched.
- Creates no image directory until an accepted image needs saving.
- Best-effort ignores saved images in Git without replacing existing
.gitignorecontents. - Reuses Pi's image APIs—no additional production npm dependency or image decoder.
This extension displays images; it does not generate them. An image-generation tool can create a local file, then show_image can display it.
Requirements
| Platform | Requirements | Status |
|---|---|---|
| Windows | Windows Terminal, Windows PowerShell, and the PowerShell Sixel module | Core workflow verified |
| macOS | iTerm2 | Implemented, not yet tested |
Tested host: Pi 1.7.0. Windows converter checks used Sixel 0.7.1. Other Pi versions and terminal configurations are not qualified.
If Sixel is not installed, install it yourself from PowerShell:
Install-Module Sixel -Scope CurrentUser
The extension does not install software, change PowerShell execution policy, or modify Pi itself.
Install
Install from npm using Pi's package manager (after the npm release is published):
pi install npm:@tklu/pi-inline-images
Alternatively, install directly from GitHub:
pi install git:github.com/dei03236/pi-inline-images
Then start a fresh Pi session in regular mode:
pi --tui-mode regular
Using pi-imgcat? Disable or remove it first: both extensions register show_image and must not be loaded together. Keep the PowerShell Sixel module installed—it is still required on Windows.
Try a local checkout without installing
From this repository:
# Windows
pi --no-extensions -e .\index.ts --tui-mode regular
# macOS / iTerm2 (untested)
pi --no-extensions -e ./index.ts --tui-mode regular
--no-extensions disables automatic extension loading for that process; -e explicitly loads this one. This avoids image-tool conflicts without changing your installed extension configuration. The verified interactive Windows tests used this local-checkout method.
Usage
Ask Pi to display an existing file:
Show
C:/Users/me/Pictures/chart.pnginline with the caption "Quarterly results".
Or ask explicitly:
Use
show_imageto display./screenshots/result.jpg.
The tool accepts:
| Argument | Required | Description |
|---|---|---|
source |
Yes | Local image path. Relative paths resolve from the tool call's working directory. |
caption |
No | Optional caption, up to 2,000 characters. |
Paths containing spaces are supported. URLs and data URIs are not.
Reopen a conversation
Start Pi from the same project folder and continue the saved conversation:
pi --tui-mode regular --continue
Ensure this extension is loaded. If you are using the temporary -e method, include those flags again. Saved images restore from their recorded references; no new show_image request should be necessary.
Storage and privacy
Images belong to the conversation's original starting folder, not whichever directory happens to be current later:
my-project/
├── __images__/
│ └── <generated-id>.png
└── .gitignore
- The saved copy retains the original image bytes. The preview may be resized.
- The conversation stores a reference and image metadata, not encoded image bytes.
show_imagereturns text-only tool content; displaying or restoring an image does not itself attach its bytes to model input.- Paths and captions may remain in history. Normal Pi/model interactions still apply, and metadata sanitization is not a universal confidentiality guarantee.
- In Git projects, the extension attempts to add
/__images__/to the starting folder's.gitignore. If that cannot be done safely, it warns instead. Already-tracked images remain tracked. - An ignored directory is not confidential storage.
Keep __images__/ if you want restoration to work. Missing images or unavailable folders produce placeholders; the extension does not regenerate them or search other locations. Moving or renaming the project is not supported automatically. Replacing a folder at the same path cannot be detected.
If saving fails, process-local display may still be possible, but that fallback cannot survive a restart and may be evicted to stay within memory limits.
Limits and known gaps
- Still PNG and JPEG only; APNG, GIF, WebP and BMP are unsupported.
- Maximum input: 20 MiB and 25 megapixels.
- Previews fit within 60 columns × 40 rows, subject to terminal width.
- Processing is sequential, with a bounded queue and a 15-second deadline per decode/conversion stage. Slow PowerShell startup can consume part of that deadline.
- Retained preview and live-fallback data share a 32 MiB budget; active processing uses additional memory.
- EXIF metadata is accepted. The extension adds no rotation or mirroring logic and makes no orientation guarantee.
- Pi may hide its Show images setting in Windows Terminal. Block images controls model-bound images, not these local previews; it is not a display toggle.
- macOS, fullscreen and extended resource/cleanup behavior remain unverified. This is not a security sandbox for untrusted images or edited session files.
For detailed test evidence and qualification limits, see the verification notes.
Development
Development tooling consists of TypeScript, Vitest and Node.js type definitions. It is not required by users installing the extension through Pi.
npm install --legacy-peer-deps --ignore-scripts --no-audit --no-fund
npm run typecheck
npm test
Tests use synthetic images and temporary directories. On Windows, the suite includes a real PowerShell/Sixel conversion test requiring the installed module. The bundled-host loading test runs when PI_MANAGED_INSTALL_ROOT is available. Platform-dependent skips are not platform passes. Tests do not require model requests or provider credentials.
License and credits
MIT, copyright © 2026 tklu.
The Windows Sixel framing follows helpers from pi-imgcat, adapted there from pi-image-tools. Both projects' MIT notices are preserved in THIRD_PARTY_NOTICES.md.