Files
SnapOtter/apps/docs/th/tools/image/image-pad.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

3.7 KiB

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
เพิ่มระยะขอบให้ภาพเป็นสัดส่วนภาพเป้าหมายด้วยพื้นหลังสีทึบ โปร่งใส หรือเบลอ 796122da3dae human 794907dc8cf6

Image Pad

เพิ่มระยะขอบให้ภาพเป็นสัดส่วนภาพเป้าหมายโดยเพิ่มพื้นหลังสีทึบ โปร่งใส หรือเบลอรอบภาพ มีประโยชน์สำหรับการปรับภาพให้พอดีกับสัดส่วนภาพคงที่สำหรับโซเชียลมีเดียหรืองานพิมพ์โดยไม่ต้องครอบตัด

API Endpoint

POST /api/v1/tools/image/image-pad

รับข้อมูลแบบ multipart form data ที่มีไฟล์ภาพและฟิลด์ JSON settings

Parameters

Parameter Type Required Default Description
target string No "1:1" สัดส่วนภาพเป้าหมาย: 16:9, 9:16, 1:1, 4:3, 3:4, หรือ custom
ratioW integer No 1 ความกว้างสัดส่วนแบบกำหนดเอง (1-100 ใช้เมื่อ target เป็น custom)
ratioH integer No 1 ความสูงสัดส่วนแบบกำหนดเอง (1-100 ใช้เมื่อ target เป็น custom)
background string No "color" โหมดพื้นหลัง: color, transparent, หรือ blur
color string No "#ffffff" สีพื้นหลังแบบ hex (เมื่อ background เป็น color)
padding integer No 0 ระยะขอบเพิ่มเติมเป็นเปอร์เซ็นต์ของ canvas (0-50)

Example Request

curl -X POST http://localhost:1349/api/v1/tools/image/image-pad \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"target": "16:9", "background": "blur", "padding": 5}'

Example Response

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

Notes

  • โหมดพื้นหลัง blur สร้างสำเนาที่เบลอของภาพต้นฉบับเป็นการเติมระยะขอบ ทำให้ได้ผลลัพธ์ที่กลมกลืนทางสายตา
  • เมื่อใช้พื้นหลัง transparent ผลลัพธ์จะถูกแปลงเป็น PNG เพื่อรักษา alpha
  • รูปแบบผลลัพธ์ตรงกับรูปแบบนำเข้า เว้นแต่จะเกี่ยวข้องกับความโปร่งใส อินพุต HEIC, RAW, PSD และ SVG จะถูกถอดรหัสโดยอัตโนมัติก่อนการประมวลผล
  • ตั้งค่า target เป็น custom และระบุ ratioW และ ratioH สำหรับสัดส่วนภาพใดๆ ก็ได้ (เช่น ratioW: 3, ratioH: 2 สำหรับ 3:2)