Files
SnapOtter/apps/docs/zh-CN/tools/image/vignette.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.1 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
添加暗角效果,可调整强度、颜色和位置。 0b9795fea2eb human 3006e6b25805

暗角

添加使图像边缘变暗或着色的暗角效果。支持可调整的强度、颜色、半径、柔和度、圆度和中心位置。

API 端点

POST /api/v1/tools/image/vignette

接受包含图像文件和 JSON settings 字段的 multipart 表单数据。

参数

参数 类型 必填 默认值 说明
strength number 0.5 暗角不透明度(0.1-1
color string "#000000" 暗角十六进制颜色
radius integer 70 外半径,占半对角线的百分比(0-100)
softness integer 50 羽化柔和度(0-100);值越高过渡越平缓
roundness integer 100 形状:100 = 圆形,0 = 匹配图像宽高比的椭圆
centerX integer 50 水平中心位置,百分比(0-100
centerY integer 50 垂直中心位置,百分比(0-100

示例请求

curl -X POST http://localhost:1349/api/v1/tools/image/vignette \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"strength": 0.7, "radius": 60, "softness": 70}'

示例响应

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

说明

  • 较小的 radius 会使图像更多区域变暗;较大的半径会将暗角限制在最边缘处。
  • 使用非黑色的 color(例如白色或棕褐色调)可实现有创意的暗角效果。
  • 调整 centerXcenterY 可让清晰区域偏离中心,适用于将焦点引向不在画面中央的主体。
  • 输出格式与输入格式一致。HEIC、RAW、PSD 和 SVG 输入在处理前会自动解码。