# Image Upscaler 2x / 4x (CPU, clean-licence model) (`quietcrane/image-upscaler-cpu`) Actor

Upscale photos and graphics 2x, 3x or 4x from image URLs on CPU. Runs our own model, trained from scratch only on public-domain and CC0 photos, with the source of every training image listed. Batch input, PNG/JPEG/WebP output, transparency kept. No GPU, no external AI service.

- **URL**: https://apify.com/quietcrane/image-upscaler-cpu.md
- **Developed by:** [Quiet Crane](https://apify.com/quietcrane) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## Image Upscaler 2x / 4x (CPU, clean-licence model)

Make small or blurry images bigger and sharper. Give a list of image URLs and get 2x, 3x or 4x versions as PNG, JPEG or WebP. The Actor runs **clean-x4**, our own model trained from scratch only on public-domain and CC0 photos. The source of every training image is listed. It runs on CPU, so it needs no GPU and no external AI service. Your images are not sent anywhere else.

### What it is good for

- Product photos and catalogue images that are too small for today's screens.
- Old web graphics, logos and screenshots.
- Thumbnails that need a larger version for print or a hero banner.

The model works best on photos and graphics with soft or compressed edges: it sharpens edges and removes JPEG blocks and noise. It is a restoration model, not a generative one: it does not invent new details such as faces, fine texture or text. Very small text may stay unreadable.

### Input

| Field | Default | Notes |
|---|---|---|
| **Image URLs** | — | Direct links to JPEG, PNG or WebP files, up to 200 per run and 20 MB each. Only use images you have the right to process. |
| Scale | 4 | 2, 3 or 4. The model works at 4x; 2x and 3x are high-quality resizes of the 4x result, so they take the same time. |
| Output format | PNG | PNG (lossless, keeps transparency), JPEG (smallest, no transparency) or WebP (keeps transparency, max 16383 px per side). |
| JPEG/WebP quality | 92 | 50–100. |
| Max input size | 2 MP | Larger images are rejected from their header before decoding, with an error row, so one huge file cannot block the batch. |

Transparency is kept for PNG and WebP output, including palette PNGs. Photos are rotated according to their EXIF orientation, and colour profiles (ICC) are kept. Accepted inputs: JPEG, PNG, WebP.

### Output

- Each upscaled image is saved in the run's key-value store, and its public link is in `outputUrl`.
- One dataset row per input:

```json
{
  "sourceUrl": "https://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/…/records/upscaled-0001.png",
  "key": "upscaled-0001.png",
  "inputWidth": 640, "inputHeight": 640,
  "outputWidth": 2560, "outputHeight": 2560,
  "scale": 4, "format": "image/png", "bytes": 4376597, "seconds": 23.79, "error": null
}
```

A failed input (not an image, 404, too large) gets a row with `error` and does not stop the run.

### Speed and cost

Measured on one CPU core, which is what a run with the default 4 GB of memory gets on Apify. Times include saving the PNG:

| Input | Output (4x) | Time |
|---|---|---|
| 512 × 512 | 2048 × 2048 | ~14 s |
| 1000 × 1000 | 4000 × 4000 | ~56 s |
| 1414 × 1414 (2 MP) | 5656 × 5656 | ~114 s |

Peak memory stayed under 0.7 GB at 2 MP. Platform usage is about 4 GB × time. For a 512 × 512 image that is about 0.018 compute units. Giving the run more memory adds CPU cores and makes it faster.

### Pricing

Free during the testing period. You pay only the Apify platform usage of your runs.

### Model and licence

- **Weights:** `clean-x4` was trained from scratch for this Actor. No pretrained weights, no ImageNet/VGG features and no research-only datasets (DIV2K, LSDIR, Flickr2K and similar) were used.
- **Training images:** 1,052 photos:
  - 900 from the NASA Image and Video Library (US Government works, public domain in the US);
  - 152 from Wikimedia Commons marked CC0 or Public domain.
- **Provenance:** `model/DATA-MANIFEST.csv`, which ships inside the Actor, lists the source page, licence, credit line and SHA-256 of every image. `model/NOTICE.md` describes the architecture, training and test results. Ask on the Issues tab for a copy of either file.
- **Test:** on 30 photos that were not used in training, after a 4x downscale, the mean PSNR is 0.52 dB above Lanczos. With blur, noise and JPEG added it is 1.65 dB above Lanczos.
- **Known limits:**
  - Commons licence tags are set by uploaders. If a listed image is not CC0 or public domain, tell us on the Issues tab: it is removed and the model retrained without it.
  - NASA's public-domain status is a US rule.
  - This is a description, not legal advice.

### Feedback

Open an issue on the Actor's Issues tab if an image fails or the result looks wrong. Please attach the source link.

# Actor input Schema

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

Direct links to JPEG, PNG or WebP images (one per line, up to 200 per run, max 20 MB each). Only use images you have the right to process.

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

Output size multiplier. The model works at 4x; 2x and 3x are high-quality resizes of the 4x result, so they cost the same time.

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

PNG keeps every detail and transparency. JPEG is smallest but drops transparency. WebP keeps transparency and is limited to 16383 px per side.

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

Compression quality for JPEG and WebP (ignored for PNG).

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

Larger images are skipped with an error row before they are decoded. With 4 GB memory (1 CPU core) a 0.25 MP image takes ~15 s and a 1 MP image ~65 s including saving the PNG.

## Actor input object example

```json
{
  "imageUrls": [
    "https://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg"
  ],
  "scale": "4",
  "outputFormat": "png",
  "quality": 92,
  "maxInputMegapixels": 2
}
```

# Actor output Schema

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

One record per input image with the public link to the upscaled file, sizes and errors.

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

Key-value store holding the upscaled image files.

# 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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("quietcrane/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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("quietcrane/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://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~small.jpg"
  ]
}' |
apify call quietcrane/image-upscaler-cpu --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,quietcrane/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/ueOTbrBohG7I6EfbU/builds/JiyLTj8refkJHSR1Y/openapi.json
