@maheidem/pi-auto-image-attach

Pi extension: auto-attaches pasted/dragged image file paths as ImageContent blocks so the model actually sees the image.

Packages

Package details

extension

Install @maheidem/pi-auto-image-attach from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@maheidem/pi-auto-image-attach
Package
@maheidem/pi-auto-image-attach
Version
0.1.1
Published
Sep 10, 2026
Downloads
246/mo · 246/wk
Author
marcos-heidemann
License
MIT
Types
extension
Size
8.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

@maheidem/pi-auto-image-attach

A Pi extension that auto-attaches pasted image file paths as real image content.

Why

Dragging an image into the Pi TUI inserts an escaped file-path string (upstream gap: earendil-works/pi#6572). The model then only sees a path, not the image. This extension intercepts input, detects image paths (png/jpg/jpeg/webp/gif/bmp, absolute or relative, with backslash-escaped spaces), sniffs the magic bytes for the MIME type, base64-encodes the file, attaches it as ImageContent, and strips the raw path from the message text.

Only fires for interactive input with no already-attached images; silently passes through otherwise.

Install

pi install npm:@maheidem/pi-auto-image-attach

Or add the path to ~/.pi/agent/settings.json → packages, then /reload.

Caveats

  • Relative paths resolve against pi's CWD.
  • Vision still depends on the active model's input supporting images (see model-discovery's vision override for local oMLX models).