SuperAPI AI 工具集

qwen-image-2

设计与创作

查看项目

更新于 10-16 09:41

技能介绍

用途

Qwen-Image-2 是一个用于图像生成与编辑的技能,通过 inference.sh CLI(belt)调用阿里巴巴的 Qwen-Image-2.0 系列模型。它面向需要在命令行环境中批量或脚本化生成、编辑图像的用户。

主要能力

该技能提供两个模型:

  • Qwen-Image-2.0(App ID:alibaba/qwen-image-2):速度快,文字渲染能力良好,适合通用场景。
  • Qwen-Image-2.0-Pro(App ID:alibaba/qwen-image-2-pro):标准速度,文字渲染专业,适合海报、文字密集的设计。

支持的功能包括:

  • 文生图(text-to-image)
  • 多图生成(num_images 1-6)
  • 自定义分辨率(width/height 512-2048,总像素需在 512×512 至 2048×2048 之间)
  • 负向提示词(negative_prompt,最多 500 字符)
  • 随机种子(seed,0-2147483647)用于复现
  • 提示词扩展(prompt_extend,默认开启)
  • 多参考图像编辑(reference_images,1-3 张)
  • 水印开关(watermark)

输出为 PNG 格式图像数组,以及包含尺寸和数量的 output_meta 元数据。

使用方式

首先安装 belt CLI 技能:

npx skills add belt-sh/cli

然后登录:

belt login

基本文生图示例:

belt app run alibaba/qwen-image-2 --input '{"prompt": "A serene mountain landscape at sunset"}'

生成多张图像:

belt app run alibaba/qwen-image-2 --input '{
  "prompt": "Minimalist logo design for a coffee shop",
  "num_images": 4
}'

自定义分辨率(Pro 模型):

belt app run alibaba/qwen-image-2-pro --input '{
  "prompt": "Panoramic mountain landscape with northern lights",
  "width": 1536,
  "height": 1024
}'

文字密集海报(Pro 模型):

belt app run alibaba/qwen-image-2-pro --input '{
  "prompt": "Poster with title \"Summer Sale!\" in bold red text at the top. Subtitle \"50% Off Everything\" in blue below. Beach background with palm trees.",
  "width": 1024,
  "height": 1536,
  "prompt_extend": false
}'

多参考图像编辑:

belt app run alibaba/qwen-image-2 --input '{
  "prompt": "Make the girl from Image 1 wear the dress from Image 2 in the pose from Image 3",
  "reference_images": [
    {"uri": "https://example.com/person.jpg"},
    {"uri": "https://example.com/dress.jpg"},
    {"uri": "https://example.com/pose.jpg"}
  ]
}'

使用负向提示词:

belt app run alibaba/qwen-image-2-pro --input '{
  "prompt": "Professional headshot portrait, studio lighting",
  "negative_prompt": "low resolution, blurry, deformed, oversaturated"
}'

使用种子复现:

belt app run alibaba/qwen-image-2 --input '{
  "prompt": "Abstract geometric art in blue and gold",
  "seed": 12345
}'

搜索 Qwen Image 应用:

belt app search "qwen image"

示例工作流:

# 1. 生成示例输入以查看所有选项
belt app sample alibaba/qwen-image-2-pro --save input.json

# 2. 编辑提示词
# 3. 运行
belt app run alibaba/qwen-image-2-pro --input input.json

输入参数

参数 类型 说明
prompt string 必填。要生成或编辑的内容(最多 800 字符)
reference_images array 用于编辑的输入图像(1-3 张)
num_images integer 生成图像数量(1-6)
width integer 输出宽度(像素,512-2048)
height integer 输出高度(像素,512-2048)
watermark boolean 添加 "Qwen-Image" 水印
negative_prompt string 要避免的内容(最多 500 字符)
prompt_extend boolean 启用提示词重写(默认:true)
seed integer 用于复现的随机种子(0-2147483647)

尺寸约束:总像素必须在 512×512 至 2048×2048 之间。

输出

字段 类型 说明
images array 生成或编辑的图像(PNG 格式)
output_meta object 包含尺寸和数量的元数据

提示词技巧

文字渲染(使用 Pro 模型):

  • 将确切文字放在引号中:"Title: "Hello World!""
  • 指定字体样式、颜色、位置
  • 设置 prompt_extend: false 以获得精确控制

风格:photorealistic、illustration、watercolor、oil painting、digital art、anime、3D render

构图:close-up、wide shot、aerial view、macro、portrait、landscape

光照:natural light、studio lighting、golden hour、dramatic shadows、neon

模型对比

特性 qwen-image-2 qwen-image-2-pro
速度 更快 标准
文字渲染 良好 专业
真实感 标准 精细
语义遵循 良好 增强

相关技能

# 完整平台技能(所有应用)
npx skills add inference-sh/skills@infsh-cli

# 所有图像生成模型
npx skills add inference-sh/skills@ai-image-generation

# 视频生成(用于图生视频)
npx skills add inference-sh/skills@ai-video-generation

浏览所有图像应用:

belt app list --category image

适用场景

  • 命令行批量生成图像
  • 需要文字渲染的海报、标题设计(推荐 Pro 模型)
  • 基于多张参考图的图像编辑与合成
  • 需要可复现结果的图像生成(使用 seed)
  • 脚本化、自动化图像生成流程

限制

  • 需要安装 inference.sh CLI(belt)并登录
  • prompt 最多 800 字符,negative_prompt 最多 500 字符
  • 参考图像数量限制为 1-3 张
  • 生成图像数量限制为 1-6 张
  • 输出尺寸限制:宽高各 512-2048,总像素在 512×512 至 2048×2048 之间
  • 关于收费、价格、平台支持等具体信息暂未提供