Files
SnapOtter/apps/docs/zh-TW/tools/image/beautify.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

4.6 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
透過漸層背景、裝置外框、陰影及社群媒體尺寸,將樸素的截圖轉為精緻影像。 8fd8a930a45e human 27db1085803f

Beautify Screenshot

為截圖加上漸層背景、裝置外框、陰影、浮水印及社群媒體尺寸。適合為產品行銷、社群媒體及文件製作精緻影像。

API Endpoint

POST /api/v1/tools/image/beautify

Parameters

Parameter Type Required Default Description
backgroundType string No "linear-gradient" 背景類型:solidlinear-gradientradial-gradientimagetransparent
backgroundColor string No "#667eea" 純色背景顏色(當 backgroundTypesolid 時使用)
gradientStops array No [{"color":"#667eea","position":0},{"color":"#764ba2","position":100}] 漸層色標(最少 2 個)。每個色標具有 color(十六進位)及 position0-100)。
gradientAngle number No 135 漸層角度(0 至 360 度)
padding number No 64 影像周圍的內距,以像素為單位(0 至 256)
borderRadius number No 12 截圖的圓角半徑(0 至 64
shadowPreset string No "subtle" 陰影預設:nonesubtlemediumdramaticcustom
shadowBlur number No 20 自訂陰影模糊半徑(0 至 100,當 shadowPresetcustom 時使用)
shadowOffsetX number No 0 自訂陰影水平偏移(-50 至 50
shadowOffsetY number No 10 自訂陰影垂直偏移(-50 至 50
shadowColor string No "#000000" 自訂陰影顏色,以十六進位表示
shadowOpacity number No 30 自訂陰影不透明度(0 至 100
frame string No "none" 裝置或視窗外框:nonemacos-lightmacos-darkwindows-lightwindows-darkbrowser-lightbrowser-darkiphoneiphone-darkmacbookmacbook-darkipadipad-dark
frameTitle string No - 顯示於視窗外框標題列的標題文字
socialPreset string No "none" 調整為社群媒體尺寸:nonetwitterlinkedininstagram-squareinstagram-storyfacebookproducthunt
watermarkText string No - 選用的浮水印文字疊層
watermarkPosition string No "bottom-right" 浮水印位置:top-lefttop-rightbottom-leftbottom-rightcenter
watermarkOpacity number No 50 浮水印不透明度(0 至 100
outputFormat string No "png" 輸出格式:pngjpegwebp

Example Request

curl -X POST http://localhost:1349/api/v1/tools/image/beautify \
  -F "file=@screenshot.png" \
  -F 'settings={"backgroundType":"linear-gradient","gradientStops":[{"color":"#667eea","position":0},{"color":"#764ba2","position":100}],"gradientAngle":135,"padding":64,"borderRadius":12,"shadowPreset":"medium","frame":"macos-dark","socialPreset":"twitter"}'

With Background Image

curl -X POST http://localhost:1349/api/v1/tools/image/beautify \
  -F "file=@screenshot.png" \
  -F "backgroundImage=@bg-texture.jpg" \
  -F 'settings={"backgroundType":"image","padding":80,"borderRadius":16,"shadowPreset":"dramatic"}'

Example Response

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/screenshot.png",
  "originalSize": 234567,
  "processedSize": 567890
}

Notes

  • 接受兩個檔案欄位:file(必填,主要截圖)及 backgroundImage(選填,當 backgroundTypeimage 時使用)。
  • 支援 HEIC、RAW、PSD 及 SVG 輸入格式(自動解碼)。
  • 陰影預設對應到特定的數值:
    • subtle:模糊 20、offsetY 4、不透明度 20%
    • medium:模糊 40、offsetY 10、不透明度 35%
    • dramatic:模糊 80、offsetY 20、不透明度 50%
  • 社群媒體預設會使用 contain 模式將最終輸出調整為符合目標尺寸:
    • twitter1600x900
    • linkedin1200x627
    • instagram-square1080x1080
    • instagram-story1080x1920
    • facebook1200x630
    • producthunt1270x760
  • 裝置外框(iphonemacbookipad)會在影像周圍套用硬體邊框,並略過 borderRadius 設定。
  • 當需要透明度時(陰影、圓角、裝置外框或透明背景),即使選取了 jpeg,輸出也會強制為 PNG。
  • 影像背景在 pipeline/批次模式中不支援。