SuperAPI AI 工具集

qwen-image-2

设计与创作

查看项目

更新于 10-15 11:00

技能介绍

用途

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):标准速度,文本渲染专业,适合海报、文字密集的设计。

支持的功能包括:文生图、多图生成(1-6 张)、自定义分辨率(宽高各 512-2048 像素)、负向提示词、随机种子复现、提示词扩展(prompt_extend),以及基于 1-3 张参考图的多参考图像编辑。

使用方式

需先安装 inference.sh CLI(belt),并安装技能:

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 search "qwen image"

输入参数

  • prompt(字符串,必填):生成或编辑的内容,最多 800 字符。
  • reference_images(数组):用于编辑的输入图像,1-3 张。
  • num_images(整数):生成图像数量,1-6。
  • width(整数):输出宽度,512-2048 像素。
  • height(整数):输出高度,512-2048 像素。
  • watermark(布尔):添加“Qwen-Image”水印。
  • negative_prompt(字符串):需避免的内容,最多 500 字符。
  • prompt_extend(布尔):启用提示词重写,默认 true。
  • seed(整数):随机种子,0-2147483647。

尺寸约束:总像素需在 512×512 与 2048×2048 之间。

输出

  • images(数组):生成或编辑后的图像,PNG 格式。
  • output_meta(对象):包含尺寸和数量的元数据。

示例

基础文生图:

belt app run alibaba/qwen-image-2 --input '{
  "prompt": "A futuristic cityscape at sunset with flying cars"
}'

多图生成:

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

自定义分辨率:

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
}'

示例工作流

# 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

适用场景

  • 通用图像生成(Qwen-Image-2.0)。
  • 海报、文字密集设计等需要专业文本渲染的场景(Qwen-Image-2.0-Pro)。
  • 基于多张参考图的图像编辑。

提示词建议

文本渲染(使用 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 为标准速度。
  • 文本渲染:qwen-image-2 良好,qwen-image-2-pro 专业。
  • 真实感:qwen-image-2 标准,qwen-image-2-pro 精细。
  • 语义遵循: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

限制

提示词最多 800 字符,负向提示词最多 500 字符,参考图 1-3 张,生成数量 1-6 张,宽高各 512-2048 像素且总像素需在 512×512 与 2048×2048 之间。使用前需安装并登录 inference.sh CLI(belt)。