image-upscale

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Image 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

输入参数

OptionRequiredDescription
--in
YesInput file path or URL
--scale
NoScale factor (2 or 4, default: 2)
--out
NoOutput path, filename or directory (default: ./)
--provider
NoProvider to use (local, fal, replicate)
--model
NoModel to use (overrides provider default)
选项必填描述
--in
输入文件路径或URL
--scale
缩放比例(可选2或4,默认值:2)
--out
输出路径、文件名或目录(默认值:./)
--provider
使用的服务提供商(可选local、fal、replicate)
--model
使用的模型(会覆盖服务提供商的默认模型)

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.jpg
Upscale 4x with specific provider:
bash
agent-media image upscale --in photo.jpg --scale 4 --provider fal
Upscale 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 ./upscaled

Providers

服务提供商

local

本地

Runs locally on CPU using Transformers.js, no API key required.
  • Uses
    Xenova/swin2SR-compressed-sr-x4-48
    model (~1.3MB)
  • Always outputs 4x upscale regardless of
    --scale
    (model architecture limitation)
  • Models downloaded on first use
  • You may see a
    mutex lock failed
    error — ignore it, the output is correct if
    "ok": true
bash
agent-media image upscale --in photo.jpg --provider local
通过Transformers.js在本地CPU运行,无需API密钥。
  • 使用
    Xenova/swin2SR-compressed-sr-x4-48
    模型(约1.3MB)
  • 无论设置
    --scale
    参数如何,始终输出4倍放大的图像(受限于模型架构)
  • 模型会在首次使用时下载
  • 你可能会看到
    mutex lock failed
    错误——可忽略该错误,若返回
    "ok": true
    则输出结果正确
bash
agent-media image upscale --in photo.jpg --provider local

fal

fal

  • Requires
    FAL_API_KEY
  • Uses
    fal-ai/esrgan
    (Real-ESRGAN) model
  • Supports 2x and 4x scale
  • 需要
    FAL_API_KEY
  • 使用
    fal-ai/esrgan
    (Real-ESRGAN)模型
  • 支持2倍和4倍缩放

replicate

replicate

  • Requires
    REPLICATE_API_TOKEN
  • Uses
    nightmareai/real-esrgan
    model
  • Supports 2-10x scale
  • 需要
    REPLICATE_API_TOKEN
  • 使用
    nightmareai/real-esrgan
    模型
  • 支持2-10倍缩放