# AI Image Upscaler 4x & 2x (Real-ESRGAN) (`srkonkel/ai-image-upscaler-cpu`) Actor

Upscale images 2x or 4x with the open-source Real-ESRGAN model. From $0.005 per image (billed per 0.25 megapixel of input). Failed images are never charged.

- **URL**: https://apify.com/srkonkel/ai-image-upscaler-cpu.md
- **Developed by:** [Wellington Pereira Konkel](https://apify.com/srkonkel) (community)
- **Categories:** AI, For creators
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 upscaled 0.25 megapixel of inputs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## AI Image Upscaler 4x & 2x (Real-ESRGAN)

**Upscale images 4x or 2x from a list of image URLs** with the open-source **Real-ESRGAN** model. You get one
result per image with a **direct download link**, and you **pay only for images that were upscaled successfully** —
failed or skipped images are never charged.

Runs on the Apify platform, so you also get the **API, scheduling, monitoring and integrations** (Make, Zapier, n8n,
webhooks) out of the box, and AI agents can call it as a tool through the **Apify MCP server**.

### What can this Actor do?

- 🔍 **Real AI upscaling, not resizing** — Real-ESRGAN general model (`realesr-general-x4v3`) with denoising.
- ↔️ **4x or 2x** output, as **PNG** (lossless), **JPEG** or **WebP**.
- 🪟 **Keeps transparency** — PNG/WebP alpha channels are preserved.
- 📦 **Batch friendly** — pass many URLs in one run; each image becomes one dataset item.
- 💸 **Predictable pricing** — billed per 0.25 megapixel of *input*; skipped/failed images cost nothing.
- 🛡️ **Safe by design** — only public http(s) images, up to 25 MB per file, and a size cap you control
  (`maxInputMegapixels`) so a huge image can't surprise your budget.

### How to upscale images

1. Click **Try for free** (or **Start**) on this page.
2. Paste your **image URLs** (one per line). JPEG, PNG, WebP, BMP, TIFF and GIF (first frame) are supported.
3. Choose **Scale** (4x or 2x) and **Output format**.
4. Click **Start** and wait for the run to finish.
5. Open the **Output** tab: each row has an `outputUrl` link to download the upscaled image.
   You can also export the list as JSON, CSV or Excel, or read it through the API.

### How much does it cost to upscale an image?

**$0.005 per 0.25 megapixel of input image** (pay-per-event `upscaled-quarter-megapixel`), plus Apify's standard
Actor start fee ($0.00005 per GB of run memory, i.e. $0.0002 per run at the default 4 GB). Platform usage is included.

| Input image size | Billed units | Price |
|---|---|---|
| 512 × 512 | 1 | $0.005 |
| 800 × 600 | 2 | $0.010 |
| 1024 × 1024 | 4 | $0.020 |
| 1920 × 1080 | 8 | $0.040 |

One unit = one started block of 512 × 512 pixels (262,144 pixels) of the input image.

- Only **successfully upscaled** images are charged. Invalid URLs, private addresses, non-images, files over
  25 MB and images above your `maxInputMegapixels` limit are skipped **without charge**.
- You can set a **maximum cost per run** in the run options; the Actor stops cleanly when it is reached.
- The Apify Free plan includes monthly platform credit that you can use to try the Actor.

### Input

| Field | Description | Default |
|---|---|---|
| `imageUrls` | List of public image URLs | — |
| `scale` | `"4"` or `"2"` (4x or 2x) | `"4"` |
| `outputFormat` | `png`, `jpg` or `webp` | `png` |
| `maxInputMegapixels` | Larger images are skipped (not charged) | `4` |
| `tileSize` | Advanced: tile size used to limit memory | `256` |

```json
{
  "imageUrls": ["https://www.gstatic.com/webp/gallery/1.jpg"],
  "scale": "4",
  "outputFormat": "png"
}
```

### Output

Each image produces one dataset item; the upscaled file is stored in the run's key-value store.

```json
{
  "index": 0,
  "status": "SUCCEEDED",
  "sourceUrl": "https://www.gstatic.com/webp/gallery/1.jpg",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/.../records/upscaled-0000.png",
  "outputKey": "upscaled-0000.png",
  "inputWidth": 550, "inputHeight": 368,
  "outputWidth": 2200, "outputHeight": 1472,
  "scale": 4, "format": "png", "billedUnits": 1, "seconds": 7.9
}
```

Failed items have `"status": "FAILED"` and an `error` message, and are not charged.

### Use it from your code (API)

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("srkonkel/ai-image-upscaler-cpu").call(
    run_input={"imageUrls": ["https://www.gstatic.com/webp/gallery/1.jpg"], "scale": "4"}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["status"], item.get("outputUrl"))
```

**JavaScript** (`npm install apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('srkonkel/ai-image-upscaler-cpu').call({
    imageUrls: ['https://www.gstatic.com/webp/gallery/1.jpg'],
    scale: '4',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((i) => i.outputUrl));
```

**cURL** (run and get the results in one call):

```bash
curl -X POST "https://api.apify.com/v2/acts/srkonkel~ai-image-upscaler-cpu/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <YOUR_APIFY_TOKEN>" -H "Content-Type: application/json" \
  -d '{"imageUrls": ["https://www.gstatic.com/webp/gallery/1.jpg"], "scale": "2"}'
```

### Use it with AI agents (MCP)

Add this Actor as a tool in the Apify MCP server and your AI agent (Claude, Cursor, and other MCP clients) can
upscale images on request, paying per image like any other user.

### FAQ

**How long does it take?** Processing time grows with the number of input pixels. Measured on Apify with the default
4 GB memory: a 550×368 image upscaled 2x in about 7 seconds.

**Does it invent details?** No. It is a general-purpose model: it sharpens and denoises, but it does not recreate
faces or text that are not present in the source image.

**Which images can I use?** Only images you have the right to process. Images must be reachable by a public
http(s) URL; private network addresses are blocked for security.

**Why was an image skipped?** Typical reasons: the URL is not public, the file is not an image, it is larger than
25 MB, or it exceeds your `maxInputMegapixels` limit. Skipped images are not charged.

**Can I automate it?** Yes — use Apify schedules, webhooks or integrations (Make, Zapier, n8n), or call the API
from your code as shown above.

### Limitations

- CPU inference: good value for batches of small and medium images; very large images take longer.
- 2x output is produced from the 4x model and then resized.

### Credits & license

Model: [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) by Xintao Wang et al., BSD-3-Clause.
The model is rebuilt from the official released weights during the Actor build and verified by SHA-256.

# Actor input Schema

## `imageUrls` (type: `array`):

Public URLs of the images to upscale (JPEG, PNG, WebP, BMP, GIF first frame, TIFF). Max 25 MB per file.

## `scale` (type: `string`):

Upscaling factor: 4x (default) or 2x.

## `outputFormat` (type: `string`):

Format of the upscaled image. PNG is lossless and keeps transparency.

## `maxInputMegapixels` (type: `number`):

Images larger than this are skipped (not charged). Protects your budget.

## `tileSize` (type: `integer`):

Images are processed in tiles to limit memory. Leave the default unless you know why.

## Actor input object example

```json
{
  "imageUrls": [
    "https://www.gstatic.com/webp/gallery/1.jpg"
  ],
  "scale": "4",
  "outputFormat": "png",
  "maxInputMegapixels": 4,
  "tileSize": 256
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "imageUrls": [
        "https://www.gstatic.com/webp/gallery/1.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("srkonkel/ai-image-upscaler-cpu").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "imageUrls": ["https://www.gstatic.com/webp/gallery/1.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("srkonkel/ai-image-upscaler-cpu").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "imageUrls": [
    "https://www.gstatic.com/webp/gallery/1.jpg"
  ]
}' |
apify call srkonkel/ai-image-upscaler-cpu --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,srkonkel/ai-image-upscaler-cpu"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/K78mbs0vClX54890B/builds/0Jqi0tOa7aVRvp4An/openapi.json
