# AI Image Upscaler: Enlarge Photos 2x, 4x or to Any Size (`pikoulas/image-upscaler`) Actor

Upscale images 2x, 4x or to an exact size with Real-ESRGAN AI: 2000 x 2000 white squares for marketplaces, 300 DPI for print. From URLs or a scraper's dataset, to PNG, JPEG or WebP. No API key, no faces made up. Images already large enough and failures are free.

- **URL**: https://apify.com/pikoulas/image-upscaler.md
- **Developed by:** [Spyridon Pikoulas](https://apify.com/pikoulas) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: Enlarge Photos 2x, 4x or to Any Size

Give it images, and get them back enlarged and sharpened by Real-ESRGAN, an AI model trained to restore detail:

- **2x, 4x or the exact size you need:** 2000 x 2000 for a marketplace's zoom, 2400 x 3000 for an 8 x 10 inch print
  at 300 DPI. Fit inside the size, pad to it with a colour (a white square for Amazon or Etsy), or crop to fill it.
  An image already that large is left as it is, free.
- **From a list of URLs or straight from another run's dataset:** point it at a product, listing or app scraper's
  results and it finds their image fields and upscales them all.
- **From JPEG, PNG, WebP, AVIF, HEIC (iPhone photos), GIF, TIFF or BMP,** up to 50 MB each, **into PNG, JPEG or WebP,**
  up to 64 megapixels out, with the **DPI** for print written into the file.
- **Transparency kept** in PNG and WebP, so logos and product cut-outs stay cut out.
- **EXIF and GPS removed,** the photo turned upright first. The colour profile is kept.
- **A preview of each result** in the run's table, with a link to each file and its size before and after.

It costs **$0.01 per image** on Apify's paid plans and $0.015 on the free plan; each started half megapixel of an
input counts as one image. An image that can't be fetched or read, or is already the size asked, costs nothing.

### What people use it for

- **E-commerce:** a scraped or supplier catalogue's small photos as 2000 x 2000 white squares, large enough for zoom
  and for a marketplace's minimum size, straight from the scraper's dataset.
- **Print:** web images and old photos at the pixels and DPI a print, a poster or print on demand needs.
- **Logos and icons:** a small logo enlarged sharp, its transparency kept.
- **Design and content:** stock thumbnails, screenshots and AI-generated images at full size.
- **Automation:** upscaling as one step of a Make, Zapier or n8n workflow.

### How to upscale images

1. Click **Try for free**; Apify's free plan covers a first run.
2. Enter the **Image URLs**, or pick a dataset under **Images from a dataset**.
3. Pick the **Scale**, or a **Width** and **Height** with a **Fit**, and the **Format**.
4. Click **Start**, then open the files from the **Output** tab, or download the dataset as JSON, CSV or Excel.

An input with every option:

```json
{
  "urls": [
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg",
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-logo.png"
  ],
  "datasetId": "YOUR_SCRAPER_RUN_DATASET_ID",
  "imageField": "imageUrl",
  "maxImages": 100,
  "width": 2000,
  "height": 2000,
  "fit": "pad",
  "format": "jpeg",
  "quality": 90,
  "background": "#ffffff",
  "dpi": 300
}
```

Without a **Width** or **Height**, the **Scale** (2x or 4x) says how much larger. With only one of them, the other
follows the image's proportions.

### Output

An App Store icon from an app scraper's dataset, made a 2000 x 2000 JPEG at 300 DPI:

```json
{
  "url": "https://is1-ssl.mzstatic.com/image/thumb/Purple211/v4/ea/1b/48/ea1b4840-9ee3-ab66-a482-659ced115cbb/AppIconProd-0-0-1x_U007epad-0-0-0-1-0-0-85-220.png/512x512bb.jpg",
  "finalUrl": "https://is1-ssl.mzstatic.com/image/thumb/Purple211/v4/ea/1b/48/ea1b4840-9ee3-ab66-a482-659ced115cbb/AppIconProd-0-0-1x_U007epad-0-0-0-1-0-0-85-220.png/512x512bb.jpg",
  "fileName": "512x512bb.jpg",
  "imageUrl": "https://api.apify.com/v2/key-value-stores/ko08De2JDNCg8pxPe/records/00000-512x512bb-2000x2000.jpeg?signature=AwtDDo8ZRLLrOnyH2MHc",
  "key": "00000-512x512bb-2000x2000.jpeg",
  "originalFormat": "JPEG",
  "format": "jpeg",
  "scale": 3.91,
  "originalWidth": 512,
  "originalHeight": 512,
  "width": 2000,
  "height": 2000,
  "megapixels": 0.26,
  "fit": "pad",
  "dpi": 300,
  "sizeBytes": 119323,
  "chargedImages": 1,
  "upscaledAt": "2026-11-21T14:41:02Z",
  "error": null
}
```

`imageUrl` opens the file as long as the run's storage is kept; `key` names it in the run's key-value store.
`scale` is how many times larger the image became, `megapixels` the input's, and `chargedImages` what it counted as. An image that can't be upscaled comes with `url`
and `error`, saying why.

### Use it as an API

Apify's API starts a run and returns its dataset as JSON; its Python and JavaScript clients, and
its Make, Zapier and n8n integrations, work the same way.

```bash
curl -X POST "https://api.apify.com/v2/acts/pikoulas~image-upscaler/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg"], "scale": "4"}'
```

AI agents can call it as a tool through Apify's MCP server: `https://mcp.apify.com?tools=pikoulas/image-upscaler`.

### Images from a dataset

Give **Images from a dataset** the ID of any dataset in your account, such as the default dataset of a run of a
product, real estate, app or social media scraper, and its items' images are upscaled with the rest. Without an
**Image field**, it takes every field named like an image (`image`, `images`, `imageUrl`, `thumbnail`, `photo`,
`logo`, `icon`...) holding a web address, a list of them or objects with a `url`; with one, only that field, a dotted
path for one inside another, such as `seller.logo`. **Max images** stops it after that many, and the same address
twice is upscaled once. The Actor is given read access to that dataset only, for that run.

In Make, Zapier, n8n or an Apify integration, start it when the scraper's run finishes, with the run's
`defaultDatasetId` as `datasetId`.

### How much does it cost?

An image up to half a megapixel (800 x 600, say) is $0.01, at 2x or 4x and in any format. A larger one counts once
per started half megapixel of the input: a 1,000 x 1,000 photo is two, $0.02, and a 2 MP one four. The size it's
upscaled to doesn't change the price, and an image already as large as the size asked comes back with a note, free. Set a spending
limit on a run and it stops there, with what it has upscaled so far.

### Good to know

- **It takes time:** about 40 seconds per input megapixel at the default 4 GB of memory, so a 6 MP photo at 2x takes
  about 4 minutes, and a 500 x 500 one at 4x about 10 seconds. With 16 GB or more it upscales one image per 8 GB at once.
- **2x is 4x scaled down,** so it costs and takes the same; pick it for a larger input or a smaller file. A size
  asked for is reached the same way: the AI enlarges 4x and the result is resized to the size. Past 4x, up to 8x, the
  rest is a plain (Lanczos) enlargement, smooth but with no detail added.
- **Fit** applies when both a width and a height are given: **Contain** keeps the whole image inside them, **Pad**
  makes it exactly that size with the **Background** colour around it, and **Cover** fills it, cropping from the
  middle. A padded image has no transparency.
- **DPI** only labels the file, PNG or JPEG, for print programs; the pixels are the width and height. WebP files
  don't carry it.
- **PNG** is lossless and its files are large; **WebP** keeps transparency in much smaller files. JPEG has none, so
  transparent parts take the **Background** colour.
- **It enlarges what is there.** Real-ESRGAN sharpens edges and removes blur, noise and JPEG blocks; it doesn't
  invent faces or text that the image is too small to show.
- Of a TIFF with several pages, a HEIC burst or an animation, only the first image is upscaled.
- **A site's refusal is respected.** It names itself in its User-Agent and reads each site's `robots.txt`, one request
  a second per site at most. A path `robots.txt` refuses isn't fetched, and a site that answers 401, 403 or 451, shows a
  verification page or answers 429 twice is left alone for the rest of the run; the rest of your list goes on. It uses
  no proxy and doesn't try to get past any of this, so an image behind a check comes back with an `error`.
- Only public addresses are fetched, not private networks.
- **Contact.** The Actor keeps nothing itself: each image stays on disk only while it's being upscaled, and files and
  results sit in the storage of whoever ran it. Questions or requests go to spyridwn.pd@gmail.com.
- Upscales with Real-ESRGAN's general model (realesr-general-x4v3, BSD-3 licence, by Xintao Wang and others) on
  ONNX Runtime, and reads images with Pillow and libheif.

### FAQ

#### Is it legal to upscale images from other websites?

It fetches only the images you point it at, as anyone could download them, without logging in, and it keeps to each
site's `robots.txt`. You are responsible for having the right to use them: images are usually someone's copyrighted
work, enlarging one doesn't change who owns it, a site's terms may limit how you use what it publishes, and people
shown in photos are protected by laws such as the GDPR and the CCPA. If you're unsure, ask a lawyer; Apify's
[Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/) is a good start.

#### Does it restore faces?

No. Faces are enlarged like the rest of the image, sharper but not redrawn, so a face too small to make out stays
that way. Face-restoration models invent the features they add, and this one keeps to what the photo shows.

#### Can I upscale images from my computer?

It reads URLs. An image you can reach only from your own computer needs a public address first, such as a record in
an Apify key-value store with public read access, or a link from your own storage.

#### Something missing or not working?

Open an issue on the **Issues** tab with the input you used, or ask there for a field you need.

If it does what you need, a review on the **Reviews** tab helps others find it.

# Actor input Schema

## `urls` (type: `array`):

The addresses of the images, or leave it empty and give a dataset below: JPEG, PNG, WebP, AVIF, HEIC, GIF (first frame), TIFF or BMP, up to 50 MB. The upscaled image can be up to 64 megapixels: 4 MP in at 4x, 16 MP at 2x. Each half megapixel of an input counts as an image: a 1,000 x 1,000 photo is two.

## `datasetId` (type: `string`):

The ID of a dataset, such as a product or listing scraper's run's: the image addresses of its items are upscaled, from the field below or, without one, from each field named like an image (image, images, photo, thumbnail, logo, icon...).

## `imageField` (type: `string`):

The dataset field the image addresses are in, a dotted path for one inside another: imageUrl, images, seller.logo. It can hold one address, a list, or objects with a url.

## `maxImages` (type: `integer`):

Upscale at most this many images, from the list and the dataset together. Empty for all.

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

How many times wider and taller the image gets, when no size is given below. Both cost the same; 2x is 4x scaled down.

## `width` (type: `integer`):

Upscale to this width instead of a scale: 2000 for a marketplace's zoom, 2400 for 8 inches at 300 DPI. With a height too, Fit says how the image takes the box; alone, the height follows the proportions. An image already this large is left as it is, free.

## `height` (type: `integer`):

Upscale to this height instead of a scale, with or without a width.

## `fit` (type: `string`):

With both a width and a height: fit the image inside them, keeping its proportions; or make it exactly that size, padded with the Background colour (a white square for a marketplace) or cropped from the middle.

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

PNG is lossless and keeps transparency, and its files are the largest; JPEG and WebP are much smaller, WebP keeps transparency too.

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

For JPEG and WebP: lower makes smaller files.

## `background` (type: `string`):

The colour transparent parts get in a JPEG, which can't keep them, and the padding with Fit on Pad: a hex code or a name such as white.

## `dpi` (type: `integer`):

Writes this resolution into PNG and JPEG files, for print: 300 makes a 2400 x 3000 image 8 x 10 inches. It changes no pixel.

## Actor input object example

```json
{
  "urls": [
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg",
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-logo.png"
  ],
  "scale": "4",
  "fit": "contain",
  "format": "png",
  "quality": 90,
  "background": "#ffffff"
}
```

# Actor output Schema

## `overview` (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 = {
    "urls": [
        "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg",
        "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-logo.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pikoulas/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 = { "urls": [
        "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg",
        "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-logo.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pikoulas/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 '{
  "urls": [
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-small.jpg",
    "https://api.apify.com/v2/key-value-stores/QlCTlJfe4QVtmurUt/records/sample-logo.png"
  ]
}' |
apify call pikoulas/image-upscaler --silent --output-dataset

```

## MCP server setup

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