@dougbots/pi-image-loader
extensionmaintainedImage-to-base64 tool for pi — lets image-capable models see local image files
by — · v0.1.1 · published 3w ago
$ pi install npm:@dougbots/pi-image-loaderdownloads/mo
197
stars
0
last push
3w ago
open issues
0
Signals
license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0
Download trend
395 downloads · last 12 weeks (weekly)
README
@dougbots/pi-image-loader
Image-to-base64 tool for pi — lets image-capable models see local image files from the filesystem.
What it does
Registers an image_to_base64 tool that:
- Reads an image file from disk (png, jpg, jpeg, gif, webp, svg, bmp, tif, tiff)
- Converts it to a base64 image content block with the correct MIME type
- Returns the image in the top-level
ImageContentshape that pi/provider adapters expect
Install
# As a pi package (recommended)
pi install git:github.com/sdougbrown/pi-image-loader
# Local development
pi install /path/to/pi-image-loader
Usage
Once installed, the image_to_base64 tool is available in your pi sessions. Pass it a file path and it returns the image as pi image content backed by base64 data:
image_to_base64(filePath: "/path/to/image.png")
Supported formats: png, jpg, jpeg, gif, webp, svg, bmp, tif, tiff.
Response
The tool returns:
- A text confirmation of the conversion
- An
imagecontent block with top-leveldataandmimeTypefields - Metadata in
details(mimeType, fileSize, resolved path)
Dependencies
- pi — the extension runtime