@dougbots/pi-image-loader

Image-to-base64 tool for pi — lets image-capable models see local image files

Packages

Package details

extension

Install @dougbots/pi-image-loader from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@dougbots/pi-image-loader
Package
@dougbots/pi-image-loader
Version
0.1.1
Published
Jul 16, 2026
Downloads
206/mo · 9/wk
Author
sdougbrown
License
MIT
Types
extension
Size
4.9 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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 ImageContent shape 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 image content block with top-level data and mimeType fields
  • Metadata in details (mimeType, fileSize, resolved path)

Dependencies

  • pi — the extension runtime