360 Secure SkillHub
360 安全技能中心

Coze Image Gen

面向文本生成图片的场景:由 npx ts-node 执行 scripts/gen.ts,调用 coze-coding-dev-sdk 生成图片。支持单张生成、随机批量生成、自定义尺寸(2K、4K 或指定宽高)以及故事模式连续生成,结果以图片链接形式打印到标准输出,也可在提示词中用引号包裹文字以渲染图中文本。

hanxueyuan
hanxueyuan
热度 69.55
最近更新 2026-05-11 09:43:32
分类:创作依赖:代码执行 / 第三方 API应用场景:图像生成 / 故事创作

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add coze-image-gen
Metadata
name
coze-image-gen
description
Create images from text prompts. Use when you need to generate/draw/create images based on descriptions.
homepage
https://www.coze.com
metadata
{"openclaw":{"emoji":"🎨","requires":{"bins":["npx"]}}}

Coze Image Generation

Generate high-quality images from text prompts using coze-coding-dev-sdk. Returns image URLs directly.

Quick Start

Single Image

npx ts-node {baseDir}/scripts/gen.ts --prompt "A futuristic city at sunset"

Batch Generation (Random Prompts)

npx ts-node {baseDir}/scripts/gen.ts --count 4

With Custom Size

npx ts-node {baseDir}/scripts/gen.ts \
  --prompt "A serene mountain landscape" \
  --size 4K

Sequential Image Generation (Story Mode)

npx ts-node {baseDir}/scripts/gen.ts \
  --prompt "A hero's journey through magical lands" \
  --sequential \
  --max-sequential 5

Script Options

Option Description
--prompt <text> Image prompt (random if omitted)
--count <n> Number of images (default: 1)
--size <size> 2K, 4K, or WIDTHxHEIGHT (default: 2K)
--sequential Enable sequential generation (story mode)
--max-sequential <n> Max images for sequential (default: 5)

Output

The script outputs image URLs directly to stdout:

[1/1] A futuristic city at sunset
  https://example.com/generated-image.png

Text in Images

Wrap text in quotes for accurate rendering:

npx ts-node {baseDir}/scripts/gen.ts \
  --prompt 'A poster with the text "Hello World" on it'

Notes

  • Size range for custom dimensions: 2560x1440 to 4096x4096
  • Image URLs have valid expiration - use directly when possible