跳至內容

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 預設組態處理,並在仍能涵蓋所要求尺寸的前提下選擇最小組態,以提供完全相符的像素尺寸而不進行放大。每種尺寸的圖像數量為一乘以 `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 預設組態處理,並在仍能涵蓋所要求尺寸的前提下選擇最小組態,以提供完全相符的像素尺寸而不進行放大。每種尺寸的圖像數量為一乘以 `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-TW/developers/models/smart-resize.md. 所有模型與指南: https://doitong.com/developers/llms.txt