image_batch_edit
Apply a single editing prompt to multiple images simultaneously, returning edited results for each input image. Handles up to 20 images per batch with independent error handling.
Instructions
批量图像编辑:N 张输入图 → N 张输出图,每张独立应用同一指令。
[WHAT] 对 image_paths 里的每一张图分别调用 image_edit,统一 prompt 与 size,结果合并返回。
[WHEN TO USE]
用户提供多张图且每张要做"同样的修改"(如批量加水印 / 统一换底 / 统一调色)→ 用此 tool。
如果是"用多张图作风格参考画 1 张新图" → 这不是此 tool,暂未实现。
如果只有 1 张图 → 用 image_edit。
[并发策略]
non-pro 模型:5 并发(HTML 网页同款)。
pro 模型:串行 + 1.5s gap(代理对 pro 并发会拒)。
任意一张失败不影响其他张;返回 results 里逐张标 ok/error。
[LIMITS]
同 image_edit:size 仅 1K 档(≤1536 边长),≥2K 拒绝。
image_paths 长度建议 2-20 张;过多请分批调用避免超时。
Args: prompt: 应用到每张图的修改指令。例:"add a subtle watermark in bottom-right". image_paths: 输入图路径列表(绝对或相对)。 size: 输出 size,仅 1K 档。默认 "1024x1024"。 model: "gpt-image-2" / "gpt-image-2-pro"。留空按 size 自动选。 save_dir: 输出目录(必须在安全根目录之下)。文件名 batch__.png。 api_key: 覆盖 MICU_API_KEY;base_url 已锁在启动期 env,运行期不接受。
Returns: dict 含: ok (bool): True 表示至少 1 张成功。 total (int): 输入图总数。 succeeded (int): 成功张数。 failed (int): 失败张数。 concurrency (int): 实际用的并发度(5 或 1)。 results (list[dict]): 每张图的详细结果(含 input 路径、saved.path、可能的 error)。
Examples: image_batch_edit( prompt="convert to pencil sketch style", image_paths=["/p/a.jpg", "/p/b.jpg", "/p/c.jpg"], size="1024x1024", )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| image_paths | Yes | ||
| size | No | 1024x1024 | |
| model | No | ||
| save_dir | No | ||
| api_key | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||