npx claudepluginhub readonme/claude_video_plugin --plugin video-creator/imageGenerate hero image using DALL-E 3 with brand-consistent visual style
/imageSmart image processing - resize, compress, convert (auto-detects single file or batch)
/imageGenerate images using Gemini 3 Pro Image model. Spawns a lightweight agent to keep main context clean.
从项目文件夹中读取 script_output.json,使用 Seedream API 批量生成高质量图像文件。
每次调用 prompt_to_image_batch 最多处理 10 个提示词
这是硬性限制,原因:
批次处理流程:
Seedream API 可能为单个 prompt 生成多张图像。当 sequential_image_generation 设置为 'on' 或 'auto' 时,模型会根据 prompt 内容推断是否需要生成序列图像(如故事、场景变化等)。
关键:调用 MCP 工具后,必须检查返回结果中的 image_count 字段:
image_count = 1: 单张图像,使用 output_file 字段image_count > 1: 多张图像,使用 images 数组获取所有图像路径script_output.json 的目录)# 基本用法(从项目文件夹读取并生成图片)
/video-creator:image /path/to/project_folder
# 仅验证图片完整性(不生成新图片)
/video-creator:image --verify /path/to/project_folder
当使用 --verify 参数时,执行图片完整性检查,如果有缺失则自动补充生成:
执行步骤:
python ${CLAUDE_PLUGIN_ROOT}/scripts/verify_images.py /path/to/project_folder
脚本会自动生成 missing_images.json,包含所有缺失图片的信息:
index: 场景索引prompt: 原始提示词missing_files: 缺失的文件列表对于 missing_files 中的每个文件:
提取画风:从原始 prompt 中提取画风描述(如 "digital drawing, stick figure style, beige background, 16:9 aspect ratio...")
定位图片描述:根据缺失文件名确定是第几张图片
image_012.png → 单图场景image_012_03.png → 第3张图片,找 "third image shows..."合并生成单张 prompt:
原始: "Generate three images of [画风]... first image shows X, second shows Y, third shows Z"
缺失: image_012_03.png (第3张)
生成: "Generate one image of [画风]... showing Z"
{
"prompts": [
{"prompt": "为 image_005.png 生成的单张 prompt"},
{"prompt": "为 image_012_03.png 生成的单张 prompt"}
],
"output_dir": "/path/to/project/images",
"output_indexes": [5, 1203],
"concurrency": 10,
"naming_pattern": "sequential",
"image_format": "png"
}
output_indexes 计算规则:
image_027.png → 27image_012_03.png → 12 * 100 + 3 = 1203🔄 第 1 次验证: 发现 5 个缺失,正在补充生成...
✅ 生成完成: 5 张图片
🔄 第 2 次验证: 发现 1 个缺失,正在补充生成...
✅ 生成完成: 1 张图片
🔄 第 3 次验证: 发现 0 个缺失
✅ 所有图片已生成完毕!
重复执行 Step 1-5,直到验证通过(无缺失)
此命令期望以下项目文件夹结构:
<project_folder>/
├── script_output.json # 输入:脚本+提示词(来自 /video-creator:scene-and-prompt)
└── images/ # 输出:图像文件将保存到这里
├── image_001.png # prompt 1 的图像(可能有多张: image_001_01.png, image_001_02.png)
├── image_002.png
└── image_metadata.json # 元数据(包含多图像信息)
<project_folder>/script_output.jsonprompt 字段的数组)<project_folder>/images/ 目录存在输出格式示例:
🎨 生成 AI 图像
================================
项目文件夹: /Users/zhenhaohua/projects/toxic_love
输入文件: script_output.json
提示词总数: 24
模型: doubao-seedream-4-0-250828
尺寸: 2K (2048x2048)
输出目录: images/
并发数: 3
准备生成图像...
重要规则:
start_index 参数确保文件命名连续根据提示词总数自动划分批次(每批最多 10 个):
| 提示词总数 | 批次数 | 每批数量 |
|---|---|---|
| 1-10 | 1 | 全部 |
| 11-20 | 2 | 10 + 剩余 |
| 21-30 | 3 | 10 + 10 + 剩余 |
| 31-40 | 4 | 10 + 10 + 10 + 剩余 |
| ... | ... | ... |
情况 A:提示词 ≤ 10 个(单批处理)
{
"json_file": "/Users/zhenhaohua/projects/toxic_love/script_output.json",
"output_dir": "/Users/zhenhaohua/projects/toxic_love/images",
"concurrency": 10,
"naming_pattern": "sequential",
"image_format": "png",
"size": "2K",
"watermark": false
}
情况 B:提示词 > 10 个(多批处理)
必须分批调用,使用 prompts 参数传入每批的提示词数组,并设置 start_index:
═══════════════════════════════════════════════════════════════
📦 批次 1/5:处理提示词 1-10
═══════════════════════════════════════════════════════════════
批次 1(提示词 1-10):
{
"prompts": [
{"prompt": "第1个提示词...", "script": "第1句脚本..."},
{"prompt": "第2个提示词...", "script": "第2句脚本..."},
...
{"prompt": "第10个提示词...", "script": "第10句脚本..."}
],
"output_dir": "/Users/zhenhaohua/projects/toxic_love/images",
"start_index": 1,
"concurrency": 10,
"naming_pattern": "sequential",
"image_format": "png",
"size": "2K",
"watermark": false
}
✅ 批次 1 完成:10/10 成功
📊 累计进度:10/45 (22.2%)
═══════════════════════════════════════════════════════════════
📦 批次 2/5:处理提示词 11-20
═══════════════════════════════════════════════════════════════
批次 2(提示词 11-20):
{
"prompts": [
{"prompt": "第11个提示词...", "script": "第11句脚本..."},
...
{"prompt": "第20个提示词...", "script": "第20句脚本..."}
],
"output_dir": "/Users/zhenhaohua/projects/toxic_love/images",
"start_index": 11,
"concurrency": 10,
"naming_pattern": "sequential",
"image_format": "png",
"size": "2K",
"watermark": false
}
继续处理批次 3, 4, 5...
| 参数 | 说明 |
|---|---|
prompts | 当前批次的提示词数组(每批最多 10 个) |
start_index | 文件命名起始索引,确保跨批次连续 |
concurrency | 并发数,固定为 10(MCP 最大支持值) |
每个批次完成后显示进度:
═══════════════════════════════════════════════════════════════
📦 批次 1/5:处理提示词 1-10
═══════════════════════════════════════════════════════════════
⏳ 处理中 1/10
✅ 已生成: image_001.png (1 张图像)
⏳ 处理中 2/10
✅ 已生成: image_002_01.png, image_002_02.png, image_002_03.png (3 张图像)
...
✅ 批次 1 完成:10/10 成功,生成 15 张图像
📊 累计进度:10/45 提示词 (22.2%)
═══════════════════════════════════════════════════════════════
📦 批次 2/5:处理提示词 11-20
═══════════════════════════════════════════════════════════════
⏳ 处理中 1/10
✅ 已生成: image_011.png (1 张图像)
...
注意: 当 sequential_image_generation 为 'auto' 或 'on' 时,模型会根据 prompt 内容自动决定生成图像数量。
所有批次完成后,必须使用验证脚本检查是否有遗漏的图片:
python ${CLAUDE_PLUGIN_ROOT}/scripts/verify_images.py /path/to/project_folder
脚本会自动:
script_output.json,获取每个提示词的 image_countimages/ 目录,对比检查missing_images.json 文件(如有缺失)image_003.png(无后缀)image_001_01.png, image_001_02.png, ...脚本会输出缺失信息并自动保存 missing_images.json:
⚠️ 缺失的图片:
- Index 15: image_015.png
Script: "Here's the reality."
Prompt: "Generate one image of..."
- Index 44: image_044_02.png, image_044_03.png
Script: "Stay with me..."
Prompt: "Generate three images of..."
缺失总数: 3 张图片 (来自 2 个提示词)
📄 缺失信息已保存到: /path/to/project/missing_images.json
可使用此文件配合 prompt_to_image_batch 补充生成缺失图片
{
"generated_at": "2024-01-15T10:30:00",
"project_folder": "/path/to/project",
"summary": {
"expected_count": 45,
"actual_count": 42,
"missing_count": 3,
"missing_prompts_count": 2
},
"missing_prompts": [
{
"index": 15,
"prompt": "Generate one image of...",
"script": "Here's the reality.",
"expected_count": 1,
"missing_files": ["image_015.png"],
"missing_count": 1
}
]
}
读取 missing_images.json,为每个缺失的图片生成单张图片的提示词,然后使用 prompt_to_image_batch 的 output_indexes 参数批量补充生成。
对于 missing_images.json 中的每个缺失文件,需要生成单张图片的提示词:
original_prompt 中提取画风描述(如 "digital drawing, stick figure style, beige background, 16:9 aspect ratio...")_03 表示第3张)在原 prompt 中找到对应的图片描述(如 "third image shows Z")示例:
原始 prompt: "Generate three images of digital drawing, stick figure style...
first image shows X, second image shows Y, third image shows Z..."
缺失文件: image_012_03.png(第3张)
生成的单张 prompt: "Generate one image of digital drawing, stick figure style...
showing Z..."
使用 prompt_to_image_batch 的 output_indexes 参数,可以批量生成非连续索引的图片:
{
"prompts": [
{"prompt": "索引5的单张图片提示词..."},
{"prompt": "索引12第3张的单张图片提示词..."},
{"prompt": "索引27的单张图片提示词..."}
],
"output_dir": "/path/to/project/images",
"output_indexes": [5, 1203, 27],
"concurrency": 10,
"naming_pattern": "sequential",
"image_format": "png"
}
output_indexes 命名规则:
27 → image_027.png)index * 100 + position(如 index=12 的第3张 → 1203 → image_012_03.png)注意:
output_indexes 数组长度必须与 prompts 数组长度一致🔄 第 1 次检查: 发现 2 个缺失,正在补充...
🔄 第 2 次检查: 发现 0 个缺失
✅ 所有图片已生成完毕!
必须循环检查,直到没有缺失的图片为止。
🎉 图像生成完成!
================================
📝 提示词总数: 45
📦 处理批次: 5 批(每批最多 10 个)
🖼️ 生成图像总数: 58 (部分 prompt 生成了多张图像)
✅ 成功: 45/45 个提示词
🔄 补充生成: 2 个(第 1 次检查时发现缺失)
📂 输出目录: /Users/zhenhaohua/projects/toxic_love/images/
💾 总大小: 116.5 MB
📝 元数据: image_metadata.json
后续命令:
创建视频: /video-creator:jianying_draft /path/to/project
doubao-seedream-4-0-2508282K (2048x2048 像素)10 (同时处理 10 个图像,MCP 支持的最大值)sequential (image_001.png, image_002.png, ...)pngfalse (无水印)/create-youtube-video/create-youtube-video生成的 image_metadata.json 支持多图像输出:
{
"source_file": "/Users/zhenhaohua/projects/toxic_love/script_output.json",
"generated_at": "2024-01-15T10:30:00Z",
"total_prompts": 24,
"total_images": 28,
"successful_generations": 23,
"failed_generations": 1,
"skipped_files": 0,
"generation_settings": {
"model": "doubao-seedream-4-0-250828",
"size": "2K",
"sequential_image_generation": "auto",
"watermark": false,
"image_format": "png"
},
"images": [
{
"index": 1,
"prompt": "A person checking phone anxiously...",
"script": "Your brain on toxic love is like a slot machine player at 3 a.m.",
"image_count": 1,
"image_files": [
{
"image_file": "image_001.png",
"absolute_path": "/Users/zhenhaohua/projects/toxic_love/images/image_001.png",
"image_size_bytes": 2456789
}
]
},
{
"index": 2,
"prompt": "A sequence showing emotional rollercoaster...",
"script": "Same reward patterns, same addiction cycles...",
"image_count": 3,
"image_files": [
{
"image_file": "image_002_01.png",
"absolute_path": "/Users/zhenhaohua/projects/toxic_love/images/image_002_01.png",
"image_size_bytes": 2345678
},
{
"image_file": "image_002_02.png",
"absolute_path": "/Users/zhenhaohua/projects/toxic_love/images/image_002_02.png",
"image_size_bytes": 2234567
},
{
"image_file": "image_002_03.png",
"absolute_path": "/Users/zhenhaohua/projects/toxic_love/images/image_002_03.png",
"image_size_bytes": 2123456
}
]
}
],
"summary": {
"total_size_bytes": 55950000,
"total_size_mb": 55.95,
"average_size_bytes": 1998214
},
"errors": [
{
"index": 15,
"prompt": "Failed prompt text...",
"error": "API timeout"
}
]
}
| 字段 | 说明 |
|---|---|
total_prompts | 输入的 prompt 总数 |
total_images | 实际生成的图像总数(可能大于 prompt 数) |
image_count | 该 prompt 生成的图像数量 |
image_files | 图像文件数组(支持多图像) |
absolute_path | 图像文件的绝对路径 |
image_001.png, image_002.png, ...image_001_01.png, image_001_02.png, image_001_03.png, ...✅ 任务成功的标志:
script_output.jsonstart_index<project_folder>/images/ 目录image_metadata.json 元数据文件,包含:
image_count 和 image_files 数组absolute_pathtotal_images 统计(可能大于 prompt 数量)images/ 子目录中image_count 字段image_count > 1 时,使用 images 数组获取所有图像路径total_images 可能大于 total_prompts