Files
SnapOtter/apps/docs/zh-TW/tools/image/upscale.md
T
SnapOtterandGitHub 4963ab3bbd feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2026-07-11 13:52:47 +08:00

2.7 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
使用 Real-ESRGAN AI 超解析度將影像放大 2 倍至 4 倍,同時保留細節。 150032e99476 human 05379b6f9563

影像放大

使用 Real-ESRGAN 的 AI 超解析度增強。將影像放大 2 至 4 倍,同時保留細節。

API 端點

POST /api/v1/tools/image/upscale

處理方式: 非同步(回傳 202,透過 SSE 輪詢 /api/v1/jobs/{jobId}/progress 以取得狀態)

模型套件: upscale-enhance5-6 GB

參數

參數 型別 必填 預設值 說明
file file - 影像檔案(multipart
scale number 2 放大倍率(例如 2、3、4
model string "auto" 要使用的模型(例如 auto、特定模型名稱)
faceEnhance boolean false 在放大過程中套用臉部增強
denoise number 0 降噪強度(0 = 關閉)
format string "auto" 輸出格式:autopngjpgwebptiffgifavifheicheifjxl
quality number 95 輸出品質(1-100

範例請求

curl -X POST http://localhost:1349/api/v1/tools/image/upscale \
  -F "file=@photo.jpg" \
  -F 'settings={"scale":4,"model":"auto","faceEnhance":true,"format":"png"}'

回應

初始回應(202 Accepted

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "async": true
}

進度(SSE 位於 /api/v1/jobs/{jobId}/progress

event: progress
data: {"phase":"processing","stage":"Upscaling...","percent":60}

最終結果(透過 SSE

{
  "phase": "complete",
  "percent": 100,
  "result": {
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "downloadUrl": "/api/v1/download/{jobId}/photo_4x.png",
    "previewUrl": "/api/v1/download/{jobId}/preview.webp",
    "originalSize": 120000,
    "processedSize": 2400000,
    "width": 4096,
    "height": 4096,
    "method": "realesrgan-x4plus"
  }
}

注意事項

  • 需要安裝 upscale-enhance 模型套件(5-6 GB)。
  • 在可用時使用 Real-ESRGAN;若 AI 模型不可用,則回退到 Lanczos 插值。
  • faceEnhance 選項會在放大過程中套用 GFPGAN 臉部修復,以獲得更佳的臉部品質。
  • 對於瀏覽器無法預覽的輸出格式(HEIC、JXL、TIFF),會在主要輸出旁另外產生 WebP 預覽。
  • 透過自動解碼支援 HEIC/HEIF、RAW、TGA、PSD、EXR 與 HDR 輸入格式。