# AI Image Upscaler (Real-ESRGAN 4x/2x, Bulk) (`toowl/ai-image-upscaler`) Actor

Upscale photos, product shots and screenshots 2x or 4x with Real-ESRGAN in bulk from URLs. Sharper detail than resizing, transparency kept, PNG/JPG/WebP out. No third-party API. Pay per image.

- **URL**: https://apify.com/toowl/ai-image-upscaler.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 image upscaleds

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/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 — Real-ESRGAN 4× / 2× in bulk

Upscale photos, product images, old scans and screenshots **4× or 2×** with Real-ESRGAN (`realesr-general-x4v3`). It restores real detail and edges instead of the blur you get from plain resizing. Give a list of image URLs, get download links back.

### Why use it

- **Bulk**: hundreds of images per run, one dataset row per image with a download link.
- **Real AI super-resolution**: Real-ESRGAN general model, tiled with overlap so there are no seams.
- **2× or 4×**: 2× is the 4× result reduced with a Lanczos filter, crisper than a 2×-trained small model.
- **Transparency kept**: PNG logos and cut-outs keep their alpha channel.
- **PNG, JPG or WebP out**, with a quality setting.
- **No third-party API**: the model runs inside the run; your images are not sent anywhere else.

### Input

```json
{
  "files": [{ "url": "https://example.com/product.jpg" }],
  "scale": "4",
  "format": "png"
}
```

Limits: up to **2 MP input for 4×** (e.g. 1600×1200 → 6400×4800) and **4 MP for 2×**. Larger images get an `error` row and are not charged.

### Output

```json
{
  "url": "https://example.com/product.jpg",
  "name": "product.jpg",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/…/records/0001-product-4x.png",
  "scale": 4,
  "widthBefore": 400,
  "heightBefore": 300,
  "width": 1600,
  "height": 1200,
  "sizeAfter": 2150331,
  "seconds": 3.1
}
```

### Use cases

- Enlarge small product photos for marketplaces (Amazon, Shopify, Etsy) that require 1000–2000 px images
- Sharpen low-resolution images scraped from the web before using them in a catalogue
- Restore old or compressed photos for print
- Upscale AI-generated images and thumbnails

### Performance

Runs on the CPU. Rough timing with 4 GB memory: a 0.5 MP image at 4× takes a few seconds, 2 MP about 20–40 s. More memory = more CPU cores = faster.

### Pricing

Pay per event: a fee per upscaled image (see the Pricing tab). Failed images are free. Cap spending with "Max cost per run".

### Free browser version

[toowl.my.id/tools/upscale-image](https://toowl.my.id/tools/upscale-image/) upscales a picture in your browser, free.

Model: Real-ESRGAN `realesr-general-x4v3` by Xintao Wang et al., BSD-3-Clause.

# Actor input Schema

## `files` (type: `array`):

Direct links to the images to upscale (JPG, PNG, WebP, AVIF, GIF, TIFF, SVG).

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

4× runs Real-ESRGAN directly. 2× is the 4× result reduced with a sharp filter (crisper than plain resizing). Inputs up to 2 MP for 4×, 4 MP for 2×.

## `format` (type: `string`):

PNG is lossless and keeps transparency. JPG and WebP are much smaller.

## `quality` (type: `integer`):

1–100. Ignored for PNG.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
    }
  ],
  "scale": "4",
  "format": "png",
  "quality": 92,
  "maxFileSizeMb": 30
}
```

# Actor output Schema

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

One row per input file, with a download link for the result where there is one.

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

Result files in the default key-value store, plus a SUMMARY record.

# 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 = {
    "files": [
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/ai-image-upscaler").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 = { "files": [{ "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg" }] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/ai-image-upscaler").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 '{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
    }
  ]
}' |
apify call toowl/ai-image-upscaler --silent --output-dataset

```

## MCP server setup

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

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/2ogt8kJB4lhp7vWag/builds/a1eeCbcGYj1M7XF2X/openapi.json
