Qwen-Image-2.0-Pro 是阿里巴巴推出的专业图像生成模型,通过 inference.sh 的命令行工具(belt CLI)调用。它面向需要高质量文字渲染与复杂设计的场景,在文字排版、写实细节和语义理解方面做了增强。
主要能力
- 专业文字渲染:支持多行、段落级文字,细节精细。
- 细粒度写实:纹理与照片级场景表现更好。
- 更强的语义遵循:更准确地执行复杂提示词。
- 复杂设计:适合文字与图像组合的设计任务。
使用方式 需先安装 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"}'
输入参数
- prompt(字符串,必填):要生成或编辑的内容,最多 800 字符。
- reference_images(数组):用于编辑的输入图像,1-3 张。
- num_images(整数):生成图像数量,1-6 张。
- width / height(整数):输出宽高,512-2048 像素。
- watermark(布尔):添加“Qwen-Image”水印。
- negative_prompt(字符串):要避免的内容,最多 500 字符。
- prompt_extend(布尔):启用提示词改写,默认 true。
- seed(整数):随机种子,0-2147483647,用于复现。 尺寸约束:总像素需在 512×512 与 2048×2048 之间。
输出
- images(数组):生成或编辑后的图像,PNG 格式。
- output_meta(对象):包含尺寸与数量的元数据。
文字渲染建议
- 用引号包裹精确文字,如 "Title: "Hello World!""。
- 指定字体细节:颜色、样式、大小、位置。
- 需要精确控制时关闭 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']}")
适用场景
- 含大量文字的海报、营销横幅、Logo 设计。
- 需要照片级写实与复杂语义的图像生成。
- 基于参考图的图像编辑与风格迁移(如换装)。
- 需要可复现结果的批量生成(通过 seed)。
限制
- 提示词最多 800 字符,负向提示词最多 500 字符。
- 参考图 1-3 张,生成数量 1-6 张。
- 输出尺寸受总像素约束(512×512 至 2048×2048)。
- 需通过 inference.sh CLI 或 Python SDK 调用,依赖相应账号登录。
- 收费、价格与平台支持情况暂未提供。