Files
SnapOtter/apps/docs/zh-TW/tools/image/rotate.md
T
SnapOtterandGitHub f858c4cea0 feat: clearer, disambiguated tool names across all surfaces (#520)
Renames 18 ambiguous or hard-to-search tool names so image tools self-qualify like the other modalities ("Compress" becomes "Compress Image"), and cleans up a few awkward names. Propagated across search (constants.ts), display (en.ts + 20 locales), the OpenAPI base spec + 20 locale specs, and the docs tool-page headings in 21 languages. Removes the duplicate "Normalize Audio" summary shared by the video and audio endpoints. Tool ids and routes are unchanged, so no API paths or bookmarks break.
2026-07-15 21:55:51 +08:00

2.1 KiB

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
將圖片旋轉任意角度並水平或垂直翻轉。 c4ed5f7e270b human 3946b7378b3f

旋轉與翻轉影像

將圖片旋轉任意角度,以及/或水平或垂直翻轉。旋轉與翻轉操作可在單一請求中結合使用。

API 端點

POST /api/v1/tools/image/rotate

接受 multipart 表單資料,包含一個圖片檔案與一個 JSON settings 欄位。

參數

參數 類型 必填 預設值 說明
angle number 0 旋轉角度(度,順時針)。接受任意數值。
horizontal boolean false 水平翻轉圖片(鏡像)
vertical boolean false 垂直翻轉圖片

範例請求

順時針旋轉 90 度:

curl -X POST http://localhost:1349/api/v1/tools/image/rotate \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"angle": 90}'

水平翻轉:

curl -X POST http://localhost:1349/api/v1/tools/image/rotate \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"horizontal": true}'

同時旋轉與翻轉:

curl -X POST http://localhost:1349/api/v1/tools/image/rotate \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"angle": 45, "vertical": true}'

範例回應

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.jpg",
  "originalSize": 2450000,
  "processedSize": 2480000
}

注意事項

  • 會先套用旋轉,接著進行翻轉操作。
  • 非 90 度的旋轉(例如 45 度)會擴大畫布以容納旋轉後的圖片,並依輸出格式填入透明或黑色。
  • 常見數值:90、180、270 用於四分之一圈旋轉。
  • 處理前會自動套用 EXIF 方向,因此旋轉是相對於視覺方向。