image-upscale
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Upscale
图像放大
Upscales an image using AI super-resolution models, increasing resolution while generating realistic detail.
借助AI超分辨率模型放大图像,在提升分辨率的同时生成逼真细节。
Command
命令
bash
agent-media image upscale --in <path> [options]bash
agent-media image upscale --in <path> [options]Inputs
输入参数
| Option | Required | Description |
|---|---|---|
| Yes | Input file path or URL |
| No | Scale factor (2 or 4, default: 2) |
| No | Output path, filename or directory (default: ./) |
| No | Provider to use (local, fal, replicate) |
| No | Model to use (overrides provider default) |
| 选项 | 必填 | 描述 |
|---|---|---|
| 是 | 输入文件路径或URL |
| 否 | 缩放比例(可选2或4,默认值:2) |
| 否 | 输出路径、文件名或目录(默认值:./) |
| 否 | 使用的服务提供商(可选local、fal、replicate) |
| 否 | 使用的模型(会覆盖服务提供商的默认模型) |
Output
输出
Returns a JSON object with the upscaled image path:
json
{
"ok": true,
"media_type": "image",
"action": "upscale",
"provider": "local",
"output_path": "upscaled_123_abc.png",
"mime": "image/png",
"bytes": 456789
}返回包含放大后图像路径的JSON对象:
json
{
"ok": true,
"media_type": "image",
"action": "upscale",
"provider": "local",
"output_path": "upscaled_123_abc.png",
"mime": "image/png",
"bytes": 456789
}Examples
示例
Upscale an image (default 2x):
bash
agent-media image upscale --in photo.jpgUpscale 4x with specific provider:
bash
agent-media image upscale --in photo.jpg --scale 4 --provider falUpscale with custom output:
bash
agent-media image upscale --in photo.jpg --out ./upscaled放大图像(默认2倍):
bash
agent-media image upscale --in photo.jpg以4倍比例放大并使用指定服务提供商:
bash
agent-media image upscale --in photo.jpg --scale 4 --provider fal自定义输出路径放大图像:
bash
agent-media image upscale --in photo.jpg --out ./upscaledProviders
服务提供商
local
本地
Runs locally on CPU using Transformers.js, no API key required.
- Uses model (~1.3MB)
Xenova/swin2SR-compressed-sr-x4-48 - Always outputs 4x upscale regardless of (model architecture limitation)
--scale - Models downloaded on first use
- You may see a error — ignore it, the output is correct if
mutex lock failed"ok": true
bash
agent-media image upscale --in photo.jpg --provider local通过Transformers.js在本地CPU运行,无需API密钥。
- 使用模型(约1.3MB)
Xenova/swin2SR-compressed-sr-x4-48 - 无论设置参数如何,始终输出4倍放大的图像(受限于模型架构)
--scale - 模型会在首次使用时下载
- 你可能会看到错误——可忽略该错误,若返回
mutex lock failed则输出结果正确"ok": true
bash
agent-media image upscale --in photo.jpg --provider localfal
fal
- Requires
FAL_API_KEY - Uses (Real-ESRGAN) model
fal-ai/esrgan - Supports 2x and 4x scale
- 需要
FAL_API_KEY - 使用(Real-ESRGAN)模型
fal-ai/esrgan - 支持2倍和4倍缩放
replicate
replicate
- Requires
REPLICATE_API_TOKEN - Uses model
nightmareai/real-esrgan - Supports 2-10x scale
- 需要
REPLICATE_API_TOKEN - 使用模型
nightmareai/real-esrgan - 支持2-10倍缩放