跳转到内容

Smart Resize

集成

模型 id smart-resize
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/smart-resize?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
    "target_sizes": [
      "1024x1024",
      "1920x1080",
      "768x1344"
    ]
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

与示例类似的文件: $0.50 500 API 积分 运行前会测量你的文件 在此页面运行

获取 API 密钥
Utility 图像编辑 4K 输出最高 4K #realism#typography#visual#ads

将图像重新构图为最多 10 种目标尺寸,适用于广告和裁剪变体

Utility · 图像

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

0 / 5000

调整大小的附加指导:空值会要求模型尽可能忠实地保留源内容。提供的任何指令都会与自动生成的调整大小提示词一起发送给 nano-banana-pro。

•必填 image_url
拖放文件,或

用于调整大小的源图像 URL。

resolution 默认 1K

内部分辨率档位提示,用于设定最低档位,而不是 `target_sizes` 指定的最终尺寸。如果该档位无法容纳请求尺寸,智能调整大小可能会自动选择更高档位。

默认 1

nano-banana-pro 的每种尺寸变体数量,决定返回的图像总数为 `len(target_sizes) * num_images_per_size`。

•必填

请求的输出尺寸列表,元素为 `<width>x<height>` 字符串,例如 `"1920x1080"`。每个目标尺寸都由 nano-banana-pro 预设覆盖,该预设在仍能覆盖请求尺寸的前提下尽可能小,从而无需放大即可精确匹配像素。每种尺寸的图像数量为 1 乘以 `num_images_per_size`。

高级 output_format · safety_tolerance · seed
output_format 默认 png

生成图像的格式。

safety_tolerance 默认 4

安全容忍度:增加此数值会使内部 nano-banana-pro /edit 调用的过滤限制变得宽松。

在所有目标尺寸之间共享的可选复现种子。提供后会传递给内部 nano-banana-pro /edit 调用。

POST /run/smart-resize?wait=20 报价 → $0.50
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/smart-resize?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
    "target_sizes": [
      "1024x1024",
      "1920x1080",
      "768x1344"
    ]
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 Smart Resize

通过重新生成构图而非简单裁剪,将源图像调整为任意尺寸。将 `target_sizes` 设置为 1 到 10 个类似 "1920x1080" 的字符串,并通过 `num_images_per_size` 为每种尺寸生成 1 到 4 个变体。可选的 `prompt` 最多 5000 个字符,用于添加指令。`resolution` 可设为 1K、2K 或 4K,输出为 png、jpeg 或 webp。

参数

发送规范名称或原生名称之一,不要同时发送两者。 规范名称

名称类型 默认值允许值 描述
image_url必填 image
类型url · image
用于调整大小的源图像 URL。
target_sizes必填
类型string[]
≤ 10 个项目
请求的输出尺寸列表,元素为 `<width>x<height>` 字符串,例如 `"1920x1080"`。每个目标尺寸都由 nano-banana-pro 预设覆盖,该预设在仍能覆盖请求尺寸的前提下尽可能小,从而无需放大即可精确匹配像素。每种尺寸的图像数量为 1 乘以 `num_images_per_size`。
prompt可选
类型string
默认值
≤ 5,000 个字符
调整大小的附加指导:空值会要求模型尽可能忠实地保留源内容。提供的任何指令都会与自动生成的调整大小提示词一起发送给 nano-banana-pro。
num_images_per_size可选
类型integer
默认值1
1 – 4
nano-banana-pro 的每种尺寸变体数量,决定返回的图像总数为 `len(target_sizes) * num_images_per_size`。
resolution可选
类型enum
默认值1K
1K2K4K
内部分辨率档位提示,用于设定最低档位,而不是 `target_sizes` 指定的最终尺寸。如果该档位无法容纳请求尺寸,智能调整大小可能会自动选择更高档位。
output_format可选
类型enum
默认值png
jpegpngwebp
生成图像的格式。
safety_tolerance可选
类型enum
默认值4
123456
安全容忍度:增加此数值会使内部 nano-banana-pro /edit 调用的过滤限制变得宽松。
seed可选
类型integer | null
在所有目标尺寸之间共享的可选复现种子。提供后会传递给内部 nano-banana-pro /edit 调用。
必填 规范名称,也可接受

文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "smart-resize",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 500,
    "usd": "0.50",
    "charged": 500,
    "refunded": 0
  },
  "input": {
    "image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
    "target_sizes": [
      "1024x1024",
      "1920x1080",
      "768x1344"
    ]
  },
  "output": {
    "images": [
      {
        "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
        "content_type": "image/jpeg",
        "file_name": "0-output.jpeg",
        "file_size": 1843200,
        "width": 1024,
        "height": 768
      }
    ],
    "description": "string",
    "results": [
      {
        "images": [
          {}
        ],
        "description": "string",
        "width": 1024,
        "height": 768,
        "aspect_ratio": "string",
        "resolution": "string"
      }
    ]
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
images
array of object {url, content_type, file_name, file_size, width, height}组合图像列表:首先包含 `target_sizes[0]` 的 `num_images_per_size` 个条目,随后是后续 `target_sizes` 的对应分组。它按与 `results` 相同的顺序包含每张生成的图像。
description
string随生成图像附带的描述。
results
array of object {images, description, width, height, aspect_ratio, resolution}每个目标的请求宽度和高度,以及处理期间使用的 nano-banana-pro 预设,由其 aspect_ratio 和分辨率标识。

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/smart-resize.md. 所有模型和指南: https://doitong.com/developers/llms.txt