@dougbots/pi-image-loader
v0.1.0
Published
Image-to-base64 tool for pi — lets image-capable models see local image files
Maintainers
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, gif, webp, svg, bmp, tiff)
- Converts it to a base64 data URL with the correct MIME type
- Returns the image in a format that vision-capable models can process
Install
# As a pi package (recommended)
pi install git:github.com/sdougbrown/pi-image-loader
# Local development
pi install /path/to/pi-image-loaderUsage
Once installed, the image_to_base64 tool is available in your pi sessions. Pass it a file path and it returns the image as a base64-encoded data URL:
image_to_base64(filePath: "/path/to/image.png")Supported formats: png, jpg, jpeg, gif, webp, svg, bmp, tiff.
Response
The tool returns:
- A text confirmation of the conversion
- An
imagecontent block with the base64 data and MIME type - Metadata in
details(mimeType, fileSize, resolved path)
Dependencies
- pi — the extension runtime
