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

61 lines
2.5 KiB
Markdown

---
description: Join images side by side, stacked, or in a grid with control over alignment, gaps, borders, and resize mode.
---
# Stitch / Combine
Join multiple images side by side, stacked vertically, or arranged in a grid. Supports alignment, gap, border, corner radius, and multiple resize modes.
## API Endpoint
`POST /api/v1/tools/image/stitch`
## Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| direction | string | No | `"horizontal"` | Layout direction: `horizontal`, `vertical`, `grid` |
| gridColumns | integer | No | 2 | Number of columns when direction is `grid` (2 to 100) |
| resizeMode | string | No | `"fit"` | How images are resized: `fit`, `original`, `stretch`, `crop` |
| alignment | string | No | `"center"` | Cross-axis alignment: `start`, `center`, `end` |
| gap | number | No | 0 | Gap between images in pixels (0 to 1000) |
| border | number | No | 0 | Outer border width in pixels (0 to 500) |
| cornerRadius | number | No | 0 | Corner radius applied to final output (0 to 500) |
| backgroundColor | string | No | `"#FFFFFF"` | Background/border color as hex (e.g. `#FF0000`) |
| format | string | No | `"png"` | Output format: `png`, `jpeg`, `webp`, `avif`, `jxl` |
| quality | number | No | 90 | Output quality (1 to 100) |
## Example Request
```bash
curl -X POST http://localhost:1349/api/v1/tools/image/stitch \
-F "file=@image1.png" \
-F "file=@image2.png" \
-F "file=@image3.png" \
-F 'settings={"direction":"horizontal","resizeMode":"fit","gap":10,"backgroundColor":"#FFFFFF","format":"png"}'
```
## Example Response
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/stitch.png",
"originalSize": 1234567,
"processedSize": 987654
}
```
## Notes
- Requires at least 2 images. Upload multiple image files in the multipart request.
- Supports HEIC, RAW, PSD, and SVG input formats (automatically decoded).
- Resize modes:
- `fit` - Scale images to match the smallest dimension along the joining axis.
- `original` - Keep original sizes (may produce uneven edges).
- `stretch` - Force images to match the smallest dimension without preserving aspect ratio.
- `crop` - Cover-crop images to match the smallest dimension.
- In `grid` mode, cells are sized to the median dimensions of all images.
- The `cornerRadius` is applied to the entire final output, not individual images.
- Canvas size is limited by the `MAX_CANVAS_PIXELS` server configuration to prevent memory exhaustion.