docs: add html-to-image tool to API docs, OpenAPI, and LLM docs

This commit is contained in:
SnapOtter
2026-06-06 21:45:39 +08:00
parent 4d7f67d2af
commit a8b79f9da5
3 changed files with 118 additions and 0 deletions
+78
View File
@@ -4138,6 +4138,84 @@ paths:
schema:
$ref: "#/components/schemas/UnauthorizedError"
/api/v1/tools/html-to-image:
post:
operationId: captureWebpage
tags: [Tools]
summary: Capture webpage as image
description: Capture a webpage as a high-quality screenshot image. Accepts a JSON body with a URL and capture options.
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [url]
properties:
url:
type: string
format: uri
description: URL to capture (http/https only)
format:
type: string
enum: [jpg, png, webp]
default: png
quality:
type: integer
minimum: 1
maximum: 100
default: 90
fullPage:
type: boolean
default: false
devicePreset:
type: string
enum: [desktop, tablet, mobile, custom]
default: desktop
viewportWidth:
type: integer
minimum: 320
maximum: 3840
default: 1280
viewportHeight:
type: integer
minimum: 320
maximum: 2160
default: 720
responses:
"200":
description: Screenshot captured successfully
content:
application/json:
schema:
$ref: "#/components/schemas/ToolResponse"
"400":
description: Invalid URL or parameters
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
description: Authentication required
content:
application/json:
schema:
$ref: "#/components/schemas/UnauthorizedError"
"503":
description: Browser service unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"504":
description: Page load timeout
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/tools/strip-metadata/inspect:
post:
operationId: inspectMetadata
+39
View File
@@ -180,6 +180,7 @@ All AI tools run on your hardware (CPU or NVIDIA GPU). No internet required.
| `qr-generate` | QR Code Generator | `data`, `size`, `margin`, `colorDark`, `colorLight`, `errorCorrectionLevel`, `dotStyle`, `cornerStyle`, `logo` (optional file) |
| `barcode-read` | Barcode Reader | - (auto-detects QR, EAN, Code128, DataMatrix, etc.) |
| `image-to-base64` | Image to Base64 | `format` (data-uri/plain), `mimeType` |
| `html-to-image` | HTML to Image | `url`, `format` (png/jpg/webp), `quality`, `fullPage`, `devicePreset` (desktop/tablet/mobile/custom), `viewportWidth`, `viewportHeight` |
### Layout & Composition
@@ -200,6 +201,44 @@ All AI tools run on your hardware (CPU or NVIDIA GPU). No internet required.
| `gif-tools` | GIF Tools | `action` (resize/optimize/reverse/speed/extract-frames/rotate/add-text), action-specific params |
| `pdf-to-image` | PDF to Image | `pages` (all/range), `format`, `dpi`, `quality` |
### HTML to Image
Capture a webpage as an image. Unlike other tools, this endpoint accepts `application/json` instead of multipart form data (no file upload needed).
**Endpoint:** `POST /api/v1/tools/html-to-image`
**Content-Type:** `application/json`
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `url` | string | (required) | URL to capture (http/https only) |
| `format` | string | `"png"` | Output format: `jpg`, `png`, `webp` |
| `quality` | number | `90` | Quality 1-100 (JPG/WebP only) |
| `fullPage` | boolean | `false` | Capture full scrollable page |
| `devicePreset` | string | `"desktop"` | `desktop`, `tablet`, `mobile`, `custom` |
| `viewportWidth` | number | `1280` | Custom viewport width 320-3840 |
| `viewportHeight` | number | `720` | Custom viewport height 320-2160 |
**Example:**
```bash
curl -X POST http://localhost:1349/api/v1/tools/html-to-image \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "format": "png", "devicePreset": "desktop"}'
```
**Response:**
```json
{
"jobId": "uuid",
"downloadUrl": "/api/v1/download/{jobId}/screenshot.png",
"originalSize": 0,
"processedSize": 54321
}
```
### Tool Sub-Routes
Some tools expose additional endpoints beyond the standard `POST /api/v1/tools/<toolId>`:
+1
View File
@@ -67,6 +67,7 @@ SnapOtter runs entirely on your own infrastructure. Images are processed locally
- [QR Code Generator](https://snapotter.com/tools/qr-generate): Custom QR codes with colors, logos, and patterns
- [Barcode Reader](https://snapotter.com/tools/barcode-read): Decode QR, Code 128, EAN-13, and more from images
- [Image to Base64](https://snapotter.com/tools/image-to-base64): Generate data URIs for HTML/CSS embedding
- [HTML to Image](https://snapotter.com/tools/html-to-image): Capture webpages as high-quality images (PNG, JPG, WebP)
## Layout and Composition Tools