agentsclimarketplace

Image gen

Skill ComeOnOliver/skillshub/skills/countbot-ai/CountBot/image-gen

AI 图片生成。通过 ModelScope API 生成图片,支持文生图、异步任务轮询、LoRA 风格叠加、自定义尺寸。当用户要求生成图片、画图、创建插画、制作海报配图时使用。From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill image-gen

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

3.9 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

AI 图片生成

基于 ModelScope API 的文生图工具,支持异步生成、LoRA 风格叠加。

配置

编辑 skills/image-gen/scripts/config.json:

{
  "api_token": "YOUR_MODELSCOPE_TOKEN"
}

Token 获取:ModelScope 控制台 创建 Access Token。

命令行调用

# 基础文生图
python3 skills/image-gen/scripts/generate.py generate --prompt "一只金色的猫"

# 指定输出路径
python3 skills/image-gen/scripts/generate.py generate --prompt "赛博朋克城市" --output cyberpunk.jpg

# 指定模型
python3 skills/image-gen/scripts/generate.py generate --prompt "水墨山水画" --model Tongyi-MAI/Z-Image-Turbo

# 使用 LoRA 风格
python3 skills/image-gen/scripts/generate.py generate --prompt "一个女孩" --lora "repo-id/lora-model"

# 多 LoRA 叠加(JSON 格式,权重之和为 1.0)
python3 skills/image-gen/scripts/generate.py generate --prompt "风景画" --lora '{"lora1": 0.6, "lora2": 0.4}'

# 指定尺寸
python3 skills/image-gen/scripts/generate.py generate --prompt "壁纸" --size 1920x1080

# 查询任务状态
python3 skills/image-gen/scripts/generate.py status --task-id TASK_ID

# JSON 格式输出
python3 skills/image-gen/scripts/generate.py generate --prompt "猫" --json

AI 调用流程

步骤 1:生成图片

根据用户描述构造英文 prompt(英文效果更好),调用脚本生成图片并保存到本地:

python3 skills/image-gen/scripts/generate.py generate --prompt "A cute golden cat, high quality, detailed fur, studio lighting" --output data/temp/images/golden_cat.jpg

步骤 2:发送到频道(自动联动 send_media)

图片生成成功后,如果当前是频道会话(飞书/QQ/钉钉/Telegram 等),必须使用内置工具 send_media 将图片发送给用户:

send_media(file_paths=["data/temp/images/golden_cat.jpg"], message="已为你生成图片 🎨")

如果是网页会话,直接告知用户图片保存路径即可。

完整示例

用户说"帮我画一只猫":

  1. 执行生成:
python3 skills/image-gen/scripts/generate.py generate --prompt "A cute golden cat, high quality, detailed fur" --output data/temp/images/cat.jpg
  1. 发送到频道:
send_media(file_paths=["data/temp/images/cat.jpg"], message="🎨 已生成图片:一只金色的猫")

用户说"画一张赛博朋克风格的城市壁纸":

  1. 执行生成:
python3 skills/image-gen/scripts/generate.py generate --prompt "Cyberpunk city skyline, neon lights, rain, cinematic, 4K" --output data/temp/images/cyberpunk.jpg --size 1920x1080
  1. 发送到频道:
send_media(file_paths=["data/temp/images/cyberpunk.jpg"], message="🎨 赛博朋克城市壁纸")

支持的模型

模型说明
Tongyi-MAI/Z-Image-Turbo默认,通义万相快速生成

可通过 --model 参数指定 ModelScope 上其他文生图模型。

Prompt 技巧

  • 使用英文 prompt 效果更好
  • 加入质量描述词:high quality, detailed, 4K, studio lighting
  • 加入风格描述:oil painting, watercolor, anime style, photorealistic
  • 加入构图描述:close-up, wide angle, bird's eye view
  • 负面描述可以在 prompt 中用 no xxx 表达

注意事项

  • 异步生成,脚本会自动轮询直到完成(默认超时 5 分钟)
  • 生成的图片建议保存到 data/temp/images/ 目录
  • LoRA 最多叠加 6 个,权重之和必须为 1.0
  • 频道会话中生成图片后务必调用 send_media 发送,不要只返回文件路径

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.