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

2.8 KiB

description
description
Expand an image canvas with AI outpainting, extending it in any direction and filling new areas to match the original.

AI Canvas Expand

Expand the canvas of an image with AI-powered fill (outpainting). Extends the image in any direction and fills the new areas with AI-generated content that matches the existing image.

API Endpoint

POST /api/v1/tools/image/ai-canvas-expand

Processing: Asynchronous (returns 202, poll /api/v1/jobs/{jobId}/progress for status via SSE)

Model bundle: object-eraser-colorize (1-2 GB)

Parameters

Parameter Type Required Default Description
file file Yes - Image file (multipart)
extendTop integer No 0 Pixels to extend at the top
extendRight integer No 0 Pixels to extend at the right
extendBottom integer No 0 Pixels to extend at the bottom
extendLeft integer No 0 Pixels to extend at the left
tier string No "balanced" Quality tier: fast, balanced, high
format string No "auto" Output format: auto, png, jpg, jpeg, webp, tiff, gif, avif, heic, heif, jxl
quality integer No 95 Output quality (1-100)

At least one extend direction must be greater than 0.

Example Request

curl -X POST http://localhost:1349/api/v1/tools/image/ai-canvas-expand \
  -F "file=@photo.jpg" \
  -F 'settings={"extendTop":200,"extendBottom":200,"extendLeft":100,"extendRight":100,"tier":"balanced"}'

Response

Initial Response (202 Accepted)

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "async": true
}

Progress (SSE at /api/v1/jobs/{jobId}/progress)

event: progress
data: {"phase":"processing","stage":"Expanding canvas...","percent":50}

Final Result (via SSE)

{
  "phase": "complete",
  "percent": 100,
  "result": {
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "downloadUrl": "/api/v1/download/{jobId}/photo_extended.png",
    "previewUrl": "/api/v1/download/{jobId}/preview.webp",
    "originalSize": 300000,
    "processedSize": 520000
  }
}

Notes

  • Requires the object-eraser-colorize model bundle to be installed (1-2 GB).
  • Uses LaMa-based outpainting to generate content for the expanded regions.
  • The tier parameter trades speed for quality: fast produces results quickly with potential artifacts, high takes longer but produces smoother, more coherent fills.
  • Extend values are in pixels. The final image dimensions will be: original width + extendLeft + extendRight by original height + extendTop + extendBottom.
  • For non-browser-previewable output formats (HEIC, JXL, TIFF), a WebP preview is generated alongside the main output.
  • Supports HEIC/HEIF, RAW, TGA, PSD, EXR, and HDR input formats via automatic decoding.