用途
Qwen-Image-2 用于通过 inference.sh CLI(belt)调用阿里巴巴 Qwen-Image-2.0 系列模型,完成文生图与图像编辑任务。
主要能力
- 提供两个模型:Qwen-Image-2.0(速度快,文本渲染良好,适合通用场景)与 Qwen-Image-2.0-Pro(标准速度,文本渲染专业,适合海报、文字密集设计)。
- 支持文生图、多图生成(1-6 张)、自定义分辨率(宽高 512-2048 像素,总像素需在 512×512 至 2048×2048 之间)。
- 支持负面提示词(最多 500 字符)、随机种子(0-2147483647)复现结果、提示词扩展(prompt_extend,默认开启)。
- 支持基于 1-3 张参考图的多参考图像编辑,例如组合人物、服装与姿势。
- 输出为 PNG 格式图像,并附带包含尺寸和数量的元数据(output_meta)。
使用方式
需先安装 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"
生成多张图像: 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"}]}'
使用负面提示词(Pro): 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}'
示例工作流:
- belt app sample alibaba/qwen-image-2-pro --save input.json
- 编辑提示词
- belt app run alibaba/qwen-image-2-pro --input input.json
输入参数
- 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:对象,包含尺寸和数量的元数据。
提示词建议
文本渲染(使用 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
限制
资料未提供收费、价格、平台支持范围、生成速度具体数值、效果保证等信息。