Files
SnapOtter/apps/docs/ja/tools/image/sprite-sheet.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.9 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
複数の画像を1枚のスプライトシートグリッドに結合し、フレームのメタデータを付与します。 1938d7fb100d human febba953c6c4

Sprite Sheet

複数の画像を1枚のスプライトシートグリッドに結合します。各画像は最初の画像の寸法に合わせてリサイズされ、グリッドに配置されます。フレームごとの座標メタデータとともにスプライトシート画像を返します。

API Endpoint

POST /api/v1/tools/image/sprite-sheet

2枚以上の画像ファイルとJSON形式のsettingsフィールドを含むmultipartフォームデータを受け付けます。

Parameters

Parameter Type Required Default Description
columns integer No 4 グリッドの列数(1〜16
padding integer No 0 セル間の余白(ピクセル、0〜64
background string No "#ffffff" 背景の16進カラー
format string No "png" 出力フォーマット: png, webp, またはjpeg
quality integer No 90 出力品質(1〜100

Example Request

curl -X POST http://localhost:1349/api/v1/tools/image/sprite-sheet \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@frame1.png" \
  -F "file=@frame2.png" \
  -F "file=@frame3.png" \
  -F "file=@frame4.png" \
  -F 'settings={"columns": 2, "padding": 4, "format": "png"}'

Example Response

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/sprite-sheet.png",
  "originalSize": 120000,
  "processedSize": 95000,
  "frames": [
    { "index": 0, "left": 0, "top": 0, "width": 128, "height": 128 },
    { "index": 1, "left": 132, "top": 0, "width": 128, "height": 128 },
    { "index": 2, "left": 0, "top": 132, "width": 128, "height": 128 },
    { "index": 3, "left": 132, "top": 132, "width": 128, "height": 128 }
  ],
  "cols": 2,
  "rows": 2,
  "cellWidth": 128,
  "cellHeight": 128,
  "canvasWidth": 260,
  "canvasHeight": 260
}

Notes

  • 2〜64枚の画像を受け付けます。すべての画像は、最初にアップロードした画像の寸法に合わせてリサイズされます。
  • frames配列は、出力内の各フレームの正確なピクセル座標を提供し、CSSスプライト定義やゲームエンジンのフレームマップに利用できます。
  • 行数は、画像数とcolumnsの値から自動的に計算されます。
  • セル間に間隔を設けるにはpaddingパラメータを使用します。backgroundの色は、余白領域や末尾の空セルに表示されます。
  • HEIC、RAW、PSD、SVGの入力は処理前に自動的にデコードされます。