aliyun-qwen-image-edit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Category: provider
分类:provider

Model Studio Qwen Image Edit

Model Studio Qwen 图像编辑

Validation

验证

bash
mkdir -p output/aliyun-qwen-image-edit
python -m py_compile skills/ai/image/aliyun-qwen-image-edit/scripts/prepare_edit_request.py && echo "py_compile_ok" > output/aliyun-qwen-image-edit/validate.txt
Pass criteria: command exits 0 and
output/aliyun-qwen-image-edit/validate.txt
is generated.
bash
mkdir -p output/aliyun-qwen-image-edit
python -m py_compile skills/ai/image/aliyun-qwen-image-edit/scripts/prepare_edit_request.py && echo "py_compile_ok" > output/aliyun-qwen-image-edit/validate.txt
通过标准:命令退出码为0,且生成
output/aliyun-qwen-image-edit/validate.txt
文件。

Output And Evidence

输出与凭证

  • Save edit request payloads, result URLs, and model parameters under
    output/aliyun-qwen-image-edit/
    .
  • Keep one sample request/response pair for reproducibility.
Use Qwen Image Edit models for instruction-based image editing instead of text-to-image generation.
  • 将编辑请求载荷、结果URL和模型参数保存在
    output/aliyun-qwen-image-edit/
    目录下。
  • 留存一组请求/响应样本用于复现。
请使用Qwen图像编辑模型完成指令驱动的图像编辑任务,而非文生图生成。

Critical model names

核心模型名称

Use one of these exact model strings:
  • qwen-image-edit
  • qwen-image-edit-plus
  • qwen-image-edit-max
  • qwen-image-2.0
  • qwen-image-2.0-pro
  • qwen-image-2.0-2026-03-03
  • qwen-image-2.0-pro-2026-03-03
  • qwen-image-edit-plus-2025-12-15
  • qwen-image-edit-max-2026-01-16
请使用以下准确的模型字符串之一:
  • qwen-image-edit
  • qwen-image-edit-plus
  • qwen-image-edit-max
  • qwen-image-2.0
  • qwen-image-2.0-pro
  • qwen-image-2.0-2026-03-03
  • qwen-image-2.0-pro-2026-03-03
  • qwen-image-edit-plus-2025-12-15
  • 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
    ,或者将
    dashscope_api_key
    添加到
    ~/.alibabacloud/credentials
    文件中。

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
    (字符串)
  • seed
    (整数)
  • request_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/aliyun-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/aliyun-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/aliyun-qwen-image-edit/images/
  • Override base dir with
    OUTPUT_DIR
    .
  • 默认输出路径:
    output/aliyun-qwen-image-edit/images/
  • 可通过
    OUTPUT_DIR
    环境变量覆盖基础目录。

Workflow

工作流程

  1. Confirm user intent, region, identifiers, and whether the operation is read-only or mutating.
  2. Run one minimal read-only query first to verify connectivity and permissions.
  3. Execute the target operation with explicit parameters and bounded scope.
  4. Verify results and save output/evidence files.
  1. 确认用户意图、区域、标识,以及操作是只读还是修改性质。
  2. 先运行一个最简只读查询验证连通性和权限。
  3. 使用明确参数和有限范围执行目标操作。
  4. 验证结果并保存输出/凭证文件。

References

参考文档

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