Skip to content

read_image — load an image as base64

read_image returns an image as base64 plus its media type, ready to feed into a multimodal Anthropic / OpenAI / Google request.

ArgTypeRequiredDescription
pathstringyesLocal file path or http:// / https:// URL.
{"path": "screenshots/dashboard.png"}
from chimera.tools.image_read import ReadImageTool
tool = ReadImageTool()
result = tool.execute(
{"path": "https://example.com/diagram.png"},
env=local_env,
)
print(result.metadata["media_type"]) # "image/png"
print(len(result.metadata["image_data"])) # base64 string length
Read 87.2 KB image: screenshots/dashboard.png (image/png)

result.metadata carries:

KeyValue
image_database64 string
media_typee.g. image/png, image/jpeg
pathecho of the input path

PNG, JPEG, GIF, and WebP — the formats accepted by every major multimodal provider.