Files
SnapOtter/apps/docs/tools/text-overlay.md
T
SnapOtter 7db6bb97da docs: add per-tool API documentation and fix parity gaps
- Create 53 per-tool VitePress documentation pages with accurate
  parameters from Zod schemas, example requests, and response formats
- Add root llms.txt for LLM-friendly repo browsing
- Fix OpenAPI spec: add auth and 422 error schemas to
  edit-metadata/inspect and strip-metadata/inspect sub-routes
- Fix tool count inconsistency (52 -> 53) across landing site,
  e2e tests, and local docs
- Rename color-adjustments.ts to adjust-colors.ts to match tool ID
- Update VitePress sidebar with all 8 tool categories and top nav
2026-06-08 11:52:28 +08:00

2.3 KiB

description
description
Add styled text overlays with drop shadows and background boxes.

Text Overlay

Add styled text to images with optional drop shadow and semi-transparent background box. Suitable for titles, captions, or annotations on photos.

API Endpoint

POST /api/v1/tools/text-overlay

Accepts multipart form data with an image file and a JSON settings field.

Parameters

Parameter Type Required Default Description
text string Yes - Text to overlay (1 to 500 characters)
fontSize number No 48 Font size in pixels (8 to 200)
color string No "#FFFFFF" Text color in hex format (#RRGGBB)
position string No "bottom" Vertical placement: top, center, bottom
backgroundBox boolean No false Show a semi-transparent background rectangle behind the text
backgroundColor string No "#000000" Background box color in hex format (#RRGGBB)
shadow boolean No true Apply a drop shadow behind the text

Example Request

curl -X POST http://localhost:1349/api/v1/tools/text-overlay \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"text": "Hello World", "fontSize": 64, "color": "#FFFFFF", "position": "bottom", "shadow": true}'

With a background box:

curl -X POST http://localhost:1349/api/v1/tools/text-overlay \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"text": "Caption", "fontSize": 36, "position": "bottom", "backgroundBox": true, "backgroundColor": "#000000"}'

Example Response

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

Notes

  • Text is always centered horizontally within the image.
  • The drop shadow uses a 2px offset with 3px blur at 70% black opacity.
  • The background box spans the full image width at 70% opacity, with height proportional to the font size (1.8x).
  • Text is rendered via SVG composite, so the system's default sans-serif font is used.
  • XML-special characters in the text are safely escaped.
  • Output format matches the input format. HEIC, RAW, PSD, and SVG inputs are automatically decoded before processing.