Function
Tool identifierimage_transform.
image_transform applies an ordered sequence of resize, crop, rotate, flip, thumbnail, grayscale, and format-conversion operations to an image and saves the result. The source can be a local path or a publicly accessible http(s) URL. For agent calls the result is saved as a conversation artifact; direct calls write it to the system temporary directory and return the path.
The tool is an async function (async def) built on Pillow and runs locally.
Import path: from veadk.tools.builtin_tools.image_transform import image_transform
Prerequisites
Environment variables:MODEL_AGENT_API_KEY: API key for the agent’s reasoning model (theimage_transformtool itself needs no extra credentials)
Usage
examples/tools/image_transform/agent.py
Parameters
Each dict in
operations uses type to select the operation:
Success returns
{"filename", "format", "width", "height", "size_bytes", "mime_type", "artifact_saved", "path"}. On failure it returns {"error": ...}.
Notes
- Remote images are capped at 20 MB with a 30-second timeout and at most 3 redirects, and use the same SSRF protection as
http_request, blocking private and loopback addresses. - The output canvas must not exceed 40,000,000 pixels, including the expanded size after rotation; larger results return an error.
- Output-format precedence is the
output_formatparameter, then theconvertoperation, then the source format; sources other than PNG/JPEG/WebP default to PNG. Saving to JPEG composites transparent areas onto a white background.