Files
SnapOtter/apps/docs/tools/image/upscale.md
T
SnapOtterandGitHub 00b651c9f8 feat(i18n): 21-language pipeline, landing/docs/API wiring, landing+API translations
Shared Claude Code translation pipeline (scripts/i18n, no API key) plus Astro/VitePress/Scalar i18n wiring. Landing and API reference translated into all 20 languages; docs i18n wiring + English source anchors. The translated docs markdown (apps/docs/<locale>/**, 3,620 files) follows in a companion PR because it exceeds GitHub's per-PR CI file limit.
2026-07-11 13:01:55 +08:00

81 lines
2.6 KiB
Markdown

---
description: Upscale images 2x to 4x with Real-ESRGAN AI super-resolution while preserving fine detail.
---
# Image Upscaling {#image-upscaling}
AI super-resolution enhancement using Real-ESRGAN. Upscales images 2x-4x while preserving detail.
## API Endpoint {#api-endpoint}
`POST /api/v1/tools/image/upscale`
**Processing:** Asynchronous (returns 202, poll `/api/v1/jobs/{jobId}/progress` for status via SSE)
**Model bundle:** `upscale-enhance` (5-6 GB)
## Parameters {#parameters}
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| file | file | Yes | - | Image file (multipart) |
| scale | number | No | `2` | Upscale factor (e.g., 2, 3, 4) |
| model | string | No | `"auto"` | Model to use (e.g., `auto`, specific model names) |
| faceEnhance | boolean | No | `false` | Apply face enhancement during upscaling |
| denoise | number | No | `0` | Denoising strength (0 = off) |
| format | string | No | `"auto"` | Output format: `auto`, `png`, `jpg`, `webp`, `tiff`, `gif`, `avif`, `heic`, `heif`, `jxl` |
| quality | number | No | `95` | Output quality (1-100) |
## Example Request {#example-request}
```bash
curl -X POST http://localhost:1349/api/v1/tools/image/upscale \
-F "file=@photo.jpg" \
-F 'settings={"scale":4,"model":"auto","faceEnhance":true,"format":"png"}'
```
## Response {#response}
### Initial Response (202 Accepted) {#initial-response-202-accepted}
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"async": true
}
```
### Progress (SSE at `/api/v1/jobs/{jobId}/progress`) {#progress-sse-at-api-v1-jobs-jobid-progress}
```
event: progress
data: {"phase":"processing","stage":"Upscaling...","percent":60}
```
### Final Result (via SSE) {#final-result-via-sse}
```json
{
"phase": "complete",
"percent": 100,
"result": {
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/{jobId}/photo_4x.png",
"previewUrl": "/api/v1/download/{jobId}/preview.webp",
"originalSize": 120000,
"processedSize": 2400000,
"width": 4096,
"height": 4096,
"method": "realesrgan-x4plus"
}
}
```
## Notes {#notes}
- Requires the `upscale-enhance` model bundle to be installed (5-6 GB).
- Uses Real-ESRGAN when available; falls back to Lanczos interpolation if the AI model is unavailable.
- The `faceEnhance` option applies GFPGAN face restoration during upscaling for better face quality.
- 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.