@maheidem/pi-auto-image-attach0.2.0
Pi extension: auto-attaches pasted/dragged image file paths as ImageContent blocks so the model actually sees the image.
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
@maheidem/pi-auto-image-attach
A pi extension that attaches pasted or dragged image file paths as real image content.
Install
pi install npm:@maheidem/pi-auto-image-attach
Then run /reload in pi.
Usage
Dragging an image into the pi TUI inserts an escaped file path (upstream gap: earendil-works/pi#6572). The model then sees only a path, not the image.
This extension reads each input event and does these steps:
- It finds image paths (png, jpg, jpeg, webp, gif, bmp). The path can be absolute or relative, with backslash-escaped spaces.
- It checks the magic bytes of the file to get the MIME type.
- It encodes the file in base64 and attaches it as
ImageContent. - It removes the raw path from the message text.
The extension acts only on interactive input that has no image already. Other input passes through. A file larger than 10 MB, or a file that is not an image, is skipped.
Relative paths resolve against the current folder of pi. The active model must accept image input. For local oMLX models, see the vision override of model-discovery.
Configuration
None. The extension has no command, no config file and no panel.
Development
npm install
npm run typecheck
npm test
npm test runs tests/run.mjs from @maheidem/pi-panel-kit/testing. See AGENTS.md.
License
MIT