> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 图片编辑与多图融合

> 传 1 ~ 3 张参考图和一条编辑指令：修改文字、增删物体、换装换景、风格迁移和多图融合。

同一个接口也用于图生图和图片编辑：在 `content` 中放 1 \~ 3 个 `{"image": "..."}` 和恰好 1 个 `{"text": "编辑指令"}`。模型可以修改图中文字、增加 / 删除 / 移动物体、改变主体动作、迁移风格、增强细节，也能把多张图中的元素融合到一张图里。

## 输入图片要求

| 项目 | 要求 |
| - | - |
| 数量 | 1 \~ 3 张 |
| 格式 | JPG、JPEG、PNG、BMP、TIFF、WEBP、GIF（GIF 动图只取第一帧） |
| 分辨率 | 宽、高均为 1 \~ 8000 像素，效果最佳为 384 \~ 2048 像素；分辨率过低会模糊，过高会变慢 |
| 宽高比 | 长边 : 短边不超过 10 : 1 |
| 大小 | 单张不超过 10 MB |
| 传入方式 | 公网 `http` / `https` 链接，或 Base64 Data URI：`data:{MIME 类型};base64,{数据}`，如 `data:image/png;base64,iVBORw0...` |

输出图片为 PNG。

## 图片顺序

图片按在 `content` 数组中出现的顺序编号：第一张是“图1”，第二张是“图2”，也可以写成“\[图1]”。`text` 放在图片前面或后面都可以。

## 单图编辑

保留人物特征，只改服装和背景；`n: 2` 一次返回 2 张候选图：

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/api/v1/services/aigc/multimodal-generation/generation" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "image": "https://your-cdn.example.com/portrait.png"
            },
            {
              "text": "保持人物的五官和发型不变，把服装换成米白色西装，背景换成现代简约的咖啡馆"
            }
          ]
        }
      ]
    },
    "parameters": {
      "n": 2,
      "prompt_extend": true
    }
  }'
```

```python Python theme={null}
import os

import requests

URL = "https://api.dreamto.ai/api/v1/services/aigc/multimodal-generation/generation"
HEADERS = {"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"}

payload = {
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "image": "https://your-cdn.example.com/portrait.png"
                    },
                    {
                        "text": "保持人物的五官和发型不变，把服装换成米白色西装，背景换成现代简约的咖啡馆"
                    }
                ]
            }
        ]
    },
    "parameters": {
        "n": 2,
        "prompt_extend": True
    }
}

result = requests.post(URL, headers=HEADERS, json=payload, timeout=300).json()
if "output" not in result:
    raise SystemExit(result)
for item in result["output"]["choices"][0]["message"]["content"]:
    print(item["image"])
```

```json theme={null}
{
  "request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "role": "assistant",
          "content": [
            {
              "type": "image",
              "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/bd/20261117/2299ae9b/qwen_image3_serving_output_0.png?Expires=1794997284&Signature=..."
            },
            {
              "type": "image",
              "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/bd/20261117/2299ae9b/qwen_image3_serving_output_1.png?Expires=1794997284&Signature=..."
            }
          ]
        }
      }
    ],
    "rewrite_status": "success"
  },
  "usage": {
    "output_width": 1328,
    "output_height": 1328,
    "input_image_count": 1,
    "input_image_type": "qima_input_1k",
    "output_image_count": 2,
    "output_image_type": "qima_output_1k"
  }
}
```

## 多图融合

用“图1”“图2”“图3”说明每张图的用途：

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/api/v1/services/aigc/multimodal-generation/generation" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "image": "https://your-cdn.example.com/girl.png"
            },
            {
              "image": "https://your-cdn.example.com/necklace.png"
            },
            {
              "image": "https://your-cdn.example.com/bag.png"
            },
            {
              "text": "图1中的女孩戴上图2中的项链，左肩背着图3中的包"
            }
          ]
        }
      ]
    },
    "parameters": {
      "size": "1104*1472",
      "seed": 42
    }
  }'
```

```python Python theme={null}
import os

import requests

URL = "https://api.dreamto.ai/api/v1/services/aigc/multimodal-generation/generation"
HEADERS = {"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"}

payload = {
    "model": "qwen-image-3.0-pro",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "image": "https://your-cdn.example.com/girl.png"
                    },
                    {
                        "image": "https://your-cdn.example.com/necklace.png"
                    },
                    {
                        "image": "https://your-cdn.example.com/bag.png"
                    },
                    {
                        "text": "图1中的女孩戴上图2中的项链，左肩背着图3中的包"
                    }
                ]
            }
        ]
    },
    "parameters": {
        "size": "1104*1472",
        "seed": 42
    }
}

result = requests.post(URL, headers=HEADERS, json=payload, timeout=300).json()
if "output" not in result:
    raise SystemExit(result)
for item in result["output"]["choices"][0]["message"]["content"]:
    print(item["image"])
```

## 常见编辑指令

| 场景 | 指令示例 |
| - | - |
| 修改文字 | 把便签上的“Take a Breather”改成“Relax and Recharge” |
| 文字样式 | 把“Qwen-Image”改成黑色手写字体 / 蓝紫渐变 / 金属材质 |
| 增加元素 | 在企鹅前面加一块写着“欢迎来到企鹅海滩”的小木牌 |
| 删除元素 | 去掉盘子里的头发 |
| 主体一致性 | 把照片改成蓝底证件照，人物穿白衬衫、黑西装、条纹领带 |
| 视角变换 | 生成正视图 / 转向左侧 / 生成背面视图 |
| 老照片修复 | 修复老照片，去除划痕、降噪、增强细节，肤色自然，五官清晰 |
| 线稿 / 深度图 / 姿态图生成 | 生成一张符合图1线稿轮廓的图片，并且符合以下描述：…… |
| 创意商品 | 把这个图案印在 T 恤和纸袋上，由一位女模特展示 |

> [!NOTE]
>
> 图片编辑只能使用 `prompt_extend_mode: direct`（默认）；传 `agent` 会返回 400。不传 `size` 时输出尺寸由模型决定，需要固定尺寸时请传 `size`。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.