alicloud-ai-image-qwen-image-edit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Category: provider
分类:服务商

Model Studio Qwen Image Edit

Model Studio Qwen 图像编辑

Use Qwen Image Edit models for instruction-based image editing instead of text-to-image generation.
使用Qwen Image Edit模型进行基于指令的图像编辑,而非文本生成图像。

Critical model names

关键模型名称

Use one of these exact model strings:
  • qwen-image-edit-max
  • qwen-image-edit-max-2026-01-16
请使用以下精确模型字符串之一:
  • qwen-image-edit-max
  • qwen-image-edit-max-2026-01-16

Prerequisites

前置条件

  • Install SDK in a virtual environment:
bash
python3 -m venv .venv
. .venv/bin/activate
python -m pip install dashscope
  • Set
    DASHSCOPE_API_KEY
    in your environment, or add
    dashscope_api_key
    to
    ~/.alibabacloud/credentials
    .
  • 在虚拟环境中安装SDK:
bash
python3 -m venv .venv
. .venv/bin/activate
python -m pip install dashscope
  • 在环境变量中设置
    DASHSCOPE_API_KEY
    ,或在
    ~/.alibabacloud/credentials
    中添加
    dashscope_api_key

Normalized interface (image.edit)

标准化接口(image.edit)

Request

请求参数

  • prompt
    (string, required)
  • image
    (string | bytes, required) source image URL/path/bytes
  • mask
    (string | bytes, optional) inpaint region mask
  • size
    (string, optional) e.g.
    1024*1024
  • seed
    (int, optional)
  • prompt
    (字符串,必填):编辑指令
  • image
    (字符串 | 字节流,必填):源图片的URL/路径/字节流
  • mask
    (字符串 | 字节流,可选):图像修复区域掩码
  • size
    (字符串,可选):例如
    1024*1024
  • seed
    (整数,可选):随机种子

Response

响应参数

  • image_url
    (string)
  • seed
    (int)
  • request_id
    (string)
  • image_url
    (字符串):生成后图片的URL
  • seed
    (整数):使用的随机种子
  • request_id
    (字符串):请求ID

Operational guidance

操作指南

  • Keep prompts task-oriented: describe what to change and what to preserve.
  • Use masks for deterministic local edits.
  • Save output assets to object storage and persist only URLs.
  • For subject consistency, provide explicit constraints in prompt.
  • 指令需以任务为导向:明确描述需要修改的内容和需要保留的部分。
  • 使用掩码实现确定性的局部编辑。
  • 将输出资源保存到对象存储中,仅持久化URL。
  • 若要保持主体一致性,请在指令中提供明确约束。

Local helper script

本地辅助脚本

Prepare a normalized request JSON and validate response schema:
bash
.venv/bin/python skills/ai/image/alicloud-ai-image-qwen-image-edit/scripts/prepare_edit_request.py \
  --prompt "Replace the sky with sunset, keep buildings unchanged" \
  --image "https://example.com/input.png"
准备标准化的请求JSON并验证响应格式:
bash
.venv/bin/python skills/ai/image/alicloud-ai-image-qwen-image-edit/scripts/prepare_edit_request.py \
  --prompt "Replace the sky with sunset, keep buildings unchanged" \
  --image "https://example.com/input.png"

Output location

输出位置

  • Default output:
    output/ai-image-qwen-image-edit/images/
  • Override base dir with
    OUTPUT_DIR
    .
  • 默认输出路径:
    output/ai-image-qwen-image-edit/images/
  • 可通过
    OUTPUT_DIR
    覆盖基础目录。

References

参考资料

  • references/sources.md
  • references/sources.md