# AI Image Upscaler & Enhancer (4K, Ultra HD) (`abzalp/ai-image-upscaler`) Actor

Upscale, sharpen, and enhance low-resolution images and photos up to 4K and 4+ megapixels using advanced AI. Clean output for print on demand, stock, and web.

- **URL**: https://apify.com/abzalp/ai-image-upscaler.md
- **Developed by:** [Abdul Basit](https://apify.com/abzalp) (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 original megapixels

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 for Stock & Print

[![Apify Store](https://img.shields.io/badge/Apify%20Store-Run%20Actor-FF9800?style=for-the-badge\&logo=apify\&logoColor=white)](https://apify.com/abzalp/ai-image-upscaler)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE)
[![Free Tier Supported](https://img.shields.io/badge/Free%20Tier-5%20USD%20Monthly-brightgreen?style=for-the-badge)](https://apify.com/abzalp/ai-image-upscaler)

> 🚀 **[Run this Actor on Apify Store](https://apify.com/abzalp/ai-image-upscaler)** — Instant cloud execution with zero setup, zero proxies needed, and free monthly credits.

Upscale photos and AI-generated images to **4, 8, 16 or up to 32 megapixels** with the Real-ESRGAN AI model. Reach the 4 MP size that stock photo sites commonly ask for, make 4K wallpapers, or prepare files for print. **No API key or account needed.** Paste links or process a whole dataset. **Images that are already big enough, and images that fail, are free.**

**What you get**

- 🎯 **Pick a size, not a factor:** choose a target in megapixels and each image is upscaled just enough to reach it, whatever its starting size.
- 🖼️ **Real AI restoration:** sharpens edges and removes JPEG blockiness and blur instead of just stretching pixels. The AI reads your picture at its full size: it's never shrunk first.
- 🔑 **Nothing to set up:** the AI runs inside the Actor, so there's no third-party key or subscription.
- 📦 **Batches:** many image URLs at once, or every image in a dataset, for example from a product or real estate scraper.
- 💸 **Simple pricing:** you pay by the size of your **original**, so a bigger target doesn't cost more. Images already at the target size are skipped for free, and failed images are never charged.
- 🧩 **Keeps transparency:** PNG and WebP output keep the alpha channel. JPG output puts transparent areas on white.
- 🔁 **Works as an integration:** runs automatically after a scraper and upscales the images it found.

### How much does it cost?

Pay-per-event pricing: a small start fee per run (it grows with the memory you give the run), plus a fee per **megapixel of your original image**, rounded to the nearest whole megapixel, with a minimum of 1. For example, a 1920 × 1080 original (2.07 MP) is billed as 2, and any original under 1.5 MP is billed as 1. The target size doesn't change the price. The **Pricing** tab shows current prices. You can set a maximum cost per run, and the Actor won't start an image your limit can't cover.

### Try it first

The example input contains the word `sample`. It upscales a small test picture that comes with the Actor, so you can see a result before using your own images. It's billed like any other image (1 megapixel). Replace it with your image links when you're ready.

### Which size should I choose?

| Target | Good for |
|---|---|
| **4 MP** (default) | Stock photo size requirements, web and social media |
| **8 MP** | 4K screens, A4 prints at about 240 DPI |
| **16 MP** | Larger prints, A3 at about 300 DPI |
| **32 MP** (maximum) | Posters |

**How enlargement works:** the AI enlarges up to **4× per side**. If your target needs more, the rest is an ordinary high-quality resize, and the result row says so. Each image can be enlarged at most **10× per side**; if that isn't enough to reach the target, the result says so.

**Largest original:** the AI enlarges originals of up to **8 MP**. A bigger original that is still below your target is marked failed and not charged. Originals that already meet the target are skipped for free.

### How long does it take?

It depends on the size of your **original**. On Apify, a 1920 × 1080 original took about **90 seconds** with the default 4 GB of memory (one CPU core), a very small one took a few seconds, and one of almost 8 MP took about **12 minutes** with the 2 GB minimum. Images run one after another. To go faster, give the run more memory (Apify adds one CPU core per 4 GB).

**Large batches:** a run stops at the time limit set in its **Run options**, so raise it for many images. If a run stops early, **resurrect** it: images already finished (upscaled, skipped or failed) aren't processed or charged again.

### Input example

```json
{
    "imageUrls": [
        "https://example.com/photos/sunset.jpg",
        "https://example.com/ai-art/cat.png"
    ],
    "targetMegapixels": 4,
    "outputFormat": "jpg"
}
```

#### Upscale images from a dataset

Pick a dataset in **Dataset with image URLs**. The Actor looks for common fields such as `imageUrl`, `image`, `thumbnailUrl` or `displayUrl`, or you can name the field in **Image URL field**, for example `images/0` for the first image in a list.

#### Use it as an integration

Open your scraper → **Integrations** → **Connect Actor or Task** → pick this Actor. Open the **JSON** tab of the integration and add `"datasetId": "{{resource.defaultDatasetId}}"`. The Dataset drop-down can't take this text, and without this line the run isn't allowed to read the results.

### Output

The upscaled images are saved in the run's **key-value store**, and the dataset lists one row per image:

```json
{
    "inputUrl": "https://example.com/photos/sunset.jpg",
    "status": "upscaled",
    "outputUrl": "https://api.apify.com/v2/key-value-stores/.../records/upscaled-0001.jpg",
    "inputWidth": 800,
    "inputHeight": 600,
    "outputWidth": 2312,
    "outputHeight": 1734,
    "outputMegapixels": 4.01,
    "upscaleFactor": 2.89,
    "billedMegapixels": 1,
    "reachesTarget": true,
    "seconds": 24.5
}
```

Statuses: `upscaled`, `skipped` (already big enough, free), `skipped-limit` (not started because of your cost limit, free), `failed` (with the reason, free).

### Supported images

JPG, PNG, WebP, GIF (first frame), TIFF and AVIF, up to 60 MB and 100 megapixels, from public `http` or `https` links. Phone photos are turned upright using their EXIF orientation. Output is sRGB with 300 DPI set in the file. Links to private or local network addresses are refused for security.

### FAQ

**Will a stock site accept the result?**
That's the stock site's decision. This Actor changes the size and cleans up compression noise, but sites also review focus, noise, content and rights, and some have rules about AI-processed or AI-generated images. Check the site's current rules before you submit, and start from the best original you have.

*This Actor is independent. It isn't affiliated with or endorsed by Adobe, Shutterstock or any other stock photo site.*

**Does it change my image?**
Yes. Real-ESRGAN redraws edges and fine texture and smooths out compression noise, so the result isn't a pixel-for-pixel copy. Contrast can look stronger. Very small or heavily compressed images can look slightly "painted", and tiny text, faces or other fine detail can come out differently. Check important details before you rely on a result.

**Some links failed with "returned a web page, not an image".**
The link opens a web page that shows the image. Right-click the image and choose **Copy image address** to get the direct link.

### Credits and license

Upscaling uses the **Real-ESRGAN** model `realesr-general-x4v3` by Xintao Wang et al., released under the BSD 3-Clause License. The license is included in the Actor's `model/` folder.

### Privacy

Images are processed inside your own Apify run and never sent to a third-party AI service. Results are stored in your run storage. The Actor runs with **limited permissions**: it can only read the dataset you choose.

***

### 🔗 Related Developer Tools & Ecosystem

Extend your automation workflows with our companion tools on the Apify Store:

- 📄 **[YouTube Transcript & Subtitle Extractor](https://apify.com/abzalp/youtube-transcript-extractor)** — Extract clean video transcripts in Markdown & JSON for AI and LLMs.
- 📊 **[Google Sheets Sync & Importer](https://apify.com/abzalp/google-sheets-sync)** — Automatically export and append Apify dataset rows directly to Google Sheets.
- 📑 **[Dataset to Excel Report Generator](https://apify.com/abzalp/dataset-to-excel-report)** — Convert raw scraping datasets into styled, formatted Excel (.xlsx) reports with auto-filters.
- 📸 **[Website Screenshot & PDF Capture API](https://apify.com/abzalp/website-screenshot)** — Capture full-page screenshots and PDFs with mobile/retina presets and ad-blocking.
- 🖼️ **[AI Image Upscaler & Enhancer](https://apify.com/abzalp/ai-image-upscaler)** — Upscale low-resolution photos and images to 4K Ultra HD.
- 🎥 **[Video Compressor & Audio Extractor](https://apify.com/abzalp/video-compressor-converter)** — Fast video compression, format conversion, and clean MP3 audio extraction.

# Changelog

This Actor's version history is a separate document: https://apify.com/abzalp/ai-image-upscaler/changelog.md

# Actor input Schema

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

Public links to JPG, PNG or WebP images, one per line. The word sample uses a small test picture that comes with the Actor.

## `targetMegapixels` (type: `integer`):

Each image is upscaled until it has at least this many megapixels. 4 MP is a common minimum for stock photo sites; 8 MP suits 4K and A4 prints; 16 MP or more suits large prints. Maximum 32 MP and 10x enlargement per side. The price depends on the size of your original, not on this target.

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

JPG is accepted by all stock sites and keeps files small. PNG is lossless and keeps transparency.

## `skipIfLargeEnough` (type: `boolean`):

Images that already meet the target size are left as they are and not charged.

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

Upscale every image in a dataset, for example the output of a scraper. When you connect this Actor as an integration, use {{resource.defaultDatasetId}} to upscale the images from the run that triggered it.

## `urlField` (type: `string`):

The dataset field that holds the image URL, for example "imageUrl" or "images/0". Leave empty to detect common names automatically.

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

Process at most this many images. 0 means all.

## Actor input object example

```json
{
  "imageUrls": [
    "sample"
  ],
  "targetMegapixels": 4,
  "outputFormat": "jpg",
  "skipIfLargeEnough": true,
  "maxImages": 0
}
```

# Actor output Schema

## `images` (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": [
        "sample"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("abzalp/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 = { "imageUrls": ["sample"] }

# Run the Actor and wait for it to finish
run = client.actor("abzalp/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 '{
  "imageUrls": [
    "sample"
  ]
}' |
apify call abzalp/ai-image-upscaler --silent --output-dataset

```

## MCP server setup

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