Files
SnapOtter/apps/docs/ja/tools/image/background-replace.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.5 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
AI を使用して画像の背景を単色またはグラデーションに置き換えます。 930fe8890e55 human a72b7f9033a8

Background Replace

画像の背景を単色またはグラデーションに置き換えます。AI モデルが被写体を検出し、元の背景を除去して、選択した背景の上に被写体を合成します。

API Endpoint

POST /api/v1/tools/image/background-replace

画像ファイルと JSON の settings フィールドを含むマルチパートフォームデータを受け付けます。

Parameters

Parameter Type Required Default Description
backgroundType string No "color" 背景モード: color または gradient
color string No "#ffffff" 背景の 16 進カラー (backgroundType が color の場合)
gradientColor1 string No - グラデーションの 1 番目の 16 進カラー
gradientColor2 string No - グラデーションの 2 番目の 16 進カラー
gradientAngle integer No 180 グラデーションの角度 (度) (0 ~ 360)
feather integer No 0 エッジのぼかし半径 (0 20)
format string No "png" 出力形式: png または webp

Example Request

curl -X POST http://localhost:1349/api/v1/tools/image/background-replace \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"backgroundType": "color", "color": "#2563eb", "feather": 2}'

Example Response

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

進捗は GET /api/v1/jobs/{jobId}/progress の SSE で追跡できます。ジョブが完了すると、SSE ストリームがダウンロード URL 付きの completed イベントを発行します。

Notes

  • これは 202 Accepted を返し、非同期で処理する AI 対応ツールです。SSE エンドポイントに接続して進捗の更新と最終結果を受け取ってください。
  • background-removal 機能バンドルのインストールが必要です。バンドルが利用できない場合は 501 を返します。
  • HEIC、RAW、PSD、SVG の入力は処理前に自動的にデコードされます。
  • 被写体周辺の透明度を保持するため、出力はデフォルトで PNG になります。