@leokon3/pi-image-paste
Windows image picker for pi running in WSL or Windows
Package details
Install @leokon3/pi-image-paste from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@leokon3/pi-image-paste- Package
@leokon3/pi-image-paste- Version
0.1.1- Published
- Sep 5, 2026
- Downloads
- 290/mo · 19/wk
- Author
- leokon3
- License
- MIT
- Types
- extension
- Size
- 22.5 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi Image Paste
English | 简体中文
A pi extension that adds /image-paste, so you can hand images to the model when pi runs inside WSL or a virtual machine.
Why This Exists
When pi runs in WSL or a VM, the clipboard and your screenshots live on the Windows host, while pi runs on the Linux side. Pi's built-in image paste (Ctrl+V) and drag-and-drop reach the terminal, not the guest filesystem, so there is no direct way to paste an image into a session. Copying files by hand through /mnt/c or a shared folder every time is slow and breaks the flow.
This extension bridges the two sides: it opens a native Windows file dialog, copies the images you pick into a private temporary directory inside the guest, and inserts those paths into the pi editor. From there the model reads them with its read tool like any other file.
Installation
pi install npm:@leokon3/pi-image-paste
Then restart pi, or run /reload in an existing session.
Usage
- Run
/image-pastein an interactive pi session. - Select one or more images in the Windows file dialog.
- The selected images are copied to a private temporary directory and their paths are inserted into the editor.
- Add an instruction if needed, then press Enter. The model inspects the images with its
readtool.
You can pass the instruction up front, and it is placed in the editor before the dialog opens:
/image-paste Compare these two screenshots and tell me what changed
Cancel the dialog to add nothing to the editor. Pi warns you if the current model has no image support.
Behavior and Limits
- Accepts PNG, JPEG, WebP, GIF, and BMP, up to 20 MiB each.
- Up to 10 images per invocation; the dialog times out after 5 minutes.
- Selections are validated by content sniffing, not just by file extension.
- Copies live in a directory created with
0700, with each file set to0600, so they stay readable for laterreadcalls, queued prompts, and session resumes. - Rejected or cancelled selections are cleaned up, leaving no temporary files behind.
- Requires interactive TUI mode, and only one dialog can be open at a time.
- Leaves pi's existing
/pastetext-paste extension untouched.
Requirements
- WSL 2 with WSL interop enabled, or a Windows VM running pi inside it
- Windows PowerShell (
powershell.exe) available onPATH - A Windows desktop session that can display Windows Forms dialogs
Native Windows pi works as well and skips the path conversion step. Linux outside WSL and macOS are not supported.
Development
git clone https://github.com/LeoKon3/pi-image-paste.git
cd pi-image-paste
pi -e ./index.ts # load the local checkout
npm test # run the test suite
License
MIT © leokon3