概述
Qwen-Image-2.0-Pro 是阿里巴巴推出的专业级图像生成模型,通过 inference.sh CLI(belt)调用。该模型面向专业文字渲染与复杂设计场景,支持文生图与图像编辑。
主要能力
- 专业文字渲染:支持多行、段落级文字,细节精细。
- 精细写实:更优质的材质纹理与照片级场景。
- 更强的语义遵循:更准确地执行复杂提示词。
- 复杂设计:适合文字与图像结合的设计。
安装与快速开始
需先安装 inference.sh CLI(belt):
npx skills add belt-sh/cli
登录并运行:
belt login
belt app run alibaba/qwen-image-2-pro --input '{"prompt": "Poster with title \"Welcome!\" in bold blue text"}'
使用方式与示例
基础文生图:
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "A futuristic cityscape at sunset with flying cars"
}'
文字密集的海报:
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "Healing-style hand-drawn poster featuring three puppies playing with a ball. The main title \"Come Play Ball!\" is prominently displayed at the top in bold, blue cartoon font. Below, the subtitle \"Join the Fun!\" appears in green font.",
"width": 1024,
"height": 1536,
"prompt_extend": false
}'
营销横幅:
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "Professional marketing banner for summer sale. Large text \"SUMMER SALE\" in white on gradient sunset background. \"50% OFF\" in yellow below. Clean, modern design.",
"width": 1920,
"height": 1080,
"prompt_extend": false,
"negative_prompt": "blurry text, distorted text, low quality"
}'
生成多个变体:
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "Minimalist logo design for a coffee shop called \"Bean & Brew\"",
"num_images": 4
}'
图像编辑(风格迁移):
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "Make the person from Image 1 wear the outfit from Image 2",
"reference_images": [
{"uri": "https://example.com/person.jpg"},
{"uri": "https://example.com/outfit.jpg"}
],
"num_images": 2
}'
可复现生成:
belt app run alibaba/qwen-image-2-pro --input '{
"prompt": "Abstract geometric art in blue and gold",
"seed": 12345
}'
输入参数
- 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):包含尺寸和数量的元数据。
文字渲染技巧
为获得最佳文字效果:
- 用引号包裹精确文字:"Title: "Hello World!""
- 指定字体细节:颜色、样式、大小、位置。
- 关闭 prompt_extend:设置 prompt_extend: false 以精确控制。
- 使用负向提示词:"blurry text, distorted text, low quality"。
示例提示词结构:
Poster with the title "GRAND OPENING" in large red serif font at the top center.
Below, the date "March 15, 2024" in smaller black text.
Background: elegant gold and white gradient.
Style: professional, clean, modern.
推荐负向提示词:
{
"negative_prompt": "low resolution, low quality, deformed limbs, deformed fingers, oversaturated, waxy, no facial details, overly smooth, AI-like, chaotic composition, blurry text, distorted text"
}
示例工作流
# 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
Python SDK
from inferencesh import inference
client = inference()
# 文字密集的海报
result = client.run({
"app": "alibaba/qwen-image-2-pro",
"input": {
"prompt": "Poster with title \"Welcome!\" in bold blue text at top",
"width": 1024,
"height": 1536,
"prompt_extend": False
}
})
print(result["output"])
# 流式实时更新
for update in client.run({
"app": "alibaba/qwen-image-2-pro",
"input": {
"prompt": "Professional product photography of a watch"
}
}, stream=True):
if update.get("progress"):
print(f"progress: {update['progress']}%")
if update.get("output"):
print(f"output: {update['output']}")
相关技能
# 标准 Qwen-Image(更快,通用)
npx skills add inference-sh/skills@qwen-image
# 完整平台技能(所有应用)
npx skills add inference-sh/skills@infsh-cli
# 所有图像生成模型
npx skills add inference-sh/skills@ai-image-generation
浏览所有图像应用:belt app list --category image
适用场景
适合需要专业文字渲染的海报、营销横幅、logo 设计,以及文字与图像结合的复杂设计任务。
限制
提示词最多 800 字符,负向提示词最多 500 字符;参考图 1-3 张;单次生成 1-6 张;输出尺寸 512-2048 像素且总像素受约束。收费与价格信息暂未提供。