GitHub 星标
0
月装机量
11
近 7 天 2
综合评分SCORE
23.7
生态多维模型
最近提交
1 个月前
2026-06-22
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@dougbots/opencode-image-loader@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@dougbots/opencode-image-loader@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @dougbots/opencode-image-loaderopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
README.md
查看原始文件→Image-to-base64 tool for opencode — 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 as a file attachment that vision-capable models can process
Install
npm install -g @dougbots/opencode-image-loader
Then add to your opencode.json plugins array:
{
"plugin": [
"@dougbots/opencode-image-loader"
]
}
Usage
Once installed, the image_to_base64 tool is available in your opencode 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
- A file attachment with the base64 data URL and MIME type
- Metadata (
mimeType,fileSize,path)
Dependencies
- @opencode-ai/plugin — the opencode plugin runtime