Files
SnapOtter/apps/docs/tools/image/border.md
T
SnapOtterandGitHub ec98dfde9a feat(landing,docs): SEO fixes and query-matched tool pages (#383)
Landing:
- Preload the Bricolage display font (LCP heading) to cut first paint
- Cap tool-page meta descriptions at ~160 chars via whole-sentence
  truncation, so SERP snippets no longer overflow or cut mid-phrase
- Drop dead HowTo + FAQPage JSON-LD from tool pages (Google removed
  HowTo rich results in 2023 and FAQ rich results in 2026); the visible
  content stays. Breadcrumb + WebApplication schema retained
- Shorten 22 tool titles that exceeded the ~60-char SERP limit
- Add an optional h1 override to tool SEO data
- Rewrite adjust-colors, smart-crop, and ringtone-maker to match real
  Search Console query intent (saturation; object-aware cropping;
  convert audio to ringtone), with query-matched H1s and FAQs

Docs:
- Add meta descriptions to 20 pages missing frontmatter

Repo:
- Ignore local credential JSON files (.secrets/, *client_secret*, *service_account*)
2026-07-01 16:20:05 +08:00

56 lines
2.4 KiB
Markdown

---
description: Add borders, padding, rounded corners, and drop shadows to images in a predictable, controllable order.
---
# Border & Frame
Add borders, padding, rounded corners, and drop shadows to images. The tool applies effects in order: padding, border, corner radius, then shadow.
## API Endpoint
`POST /api/v1/tools/image/border`
## Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| borderWidth | number | No | 10 | Border thickness in pixels (0 to 2000) |
| borderColor | string | No | `"#000000"` | Border color as hex (e.g. `#FF0000`) |
| padding | number | No | 0 | Inner padding between image and border in pixels (0 to 200) |
| paddingColor | string | No | `"#FFFFFF"` | Padding fill color as hex |
| cornerRadius | number | No | 0 | Corner radius in pixels (0 to 2000) |
| shadow | boolean | No | `false` | Whether to add a drop shadow |
| shadowBlur | number | No | 15 | Shadow blur radius (1 to 200) |
| shadowOffsetX | number | No | 0 | Shadow horizontal offset (-50 to 50) |
| shadowOffsetY | number | No | 5 | Shadow vertical offset (-50 to 50) |
| shadowColor | string | No | `"#000000"` | Shadow color as hex |
| shadowOpacity | number | No | 40 | Shadow opacity percentage (0 to 100) |
## Example Request
```bash
curl -X POST http://localhost:1349/api/v1/tools/image/border \
-F "file=@photo.jpg" \
-F 'settings={"borderWidth":20,"borderColor":"#333333","cornerRadius":16,"shadow":true,"shadowBlur":25,"shadowOpacity":50}'
```
## Example Response
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.png",
"originalSize": 456789,
"processedSize": 523456
}
```
## Notes
- Uses the standard `createToolRoute` factory. Accepts a single image file via multipart upload.
- Supports HEIC, RAW, PSD, and SVG input formats (automatically decoded).
- Processing order: padding is added first, then the border wraps around, then corner radius is applied, then the shadow is composited.
- When `cornerRadius` or `shadow` is enabled, the output is forced to PNG (regardless of input format) to preserve transparency. Formats that support alpha (PNG, WebP, AVIF) keep their original format.
- The shadow is shape-aware: it follows the rounded corners rather than creating a rectangular shadow.
- Setting `borderWidth` to 0 and using only `cornerRadius` + `shadow` creates a frameless rounded shadow effect.