# Image Converter and Compressor: WebP, AVIF, JPEG, PNG, Resize (`greenrun/image-converter`) Actor

Convert, compress and resize images in bulk: JPEG, PNG, WebP, AVIF, GIF and TIFF output, HEIC input, quality, maximum size and dimensions, EXIF and GPS removal. Images you provide only, nothing else is collected. Not found, blocked and non-image inputs are free.

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

## Pricing

from $1.50 / 1,000 images

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

## Image Converter and Compressor: WebP, AVIF, JPEG, PNG, Resize

Convert, compress and resize images in bulk: JPEG, PNG, WebP, AVIF, GIF and TIFF output, HEIC input, quality, maximum size and dimensions, EXIF and GPS removal. Images you provide only, nothing else is collected. Not found, blocked and non-image inputs are free.

Give it image links (or `data:` URIs, a key-value store with your files, or a field of a dataset) and get **every image converted to WebP, AVIF, JPEG, PNG, GIF or TIFF, compressed and resized, with EXIF and GPS location removed by default**. iPhone HEIC photos, transparent PNGs and animated GIFs work too. Each result is a file in your run's key-value store with a link, plus a row with the old and new size. **You pay for converted images; links that are not found, blocked or not images are free**, with the reason in the row (a file that turns out damaged after a valid header is charged once its decoding has started). Made for web and e-commerce image pipelines, scrapers that collect product photos, and AI agents that need images in a smaller or more common format.

### What it does

- **Converts** JPEG, PNG, WebP, AVIF, HEIC/HEIF, GIF, TIFF, BMP and more into **WebP, AVIF, JPEG, PNG, GIF or TIFF**, one row and one file per image.
- **Compresses** with a quality setting (JPEG 85, WebP 80, AVIF 60 by default) or to a **target file size** (`maxFileSizeKb`): quality goes down to 40 first, then the dimensions.
- **Resizes** to a maximum width and height, keeping the aspect ratio and never enlarging; large JPEGs are decoded at reduced scale, so thumbnails from 48 MP photos are fast.
- **Removes metadata**: EXIF, GPS location, XMP and comments are dropped by default, or EXIF is kept without GPS, or kept as is. `gpsFound` tells you which images carried a location. The colour profile stays; a large one (over 4 KB, such as Apple's 30 KB Wide Color Sharing Profile) is converted to sRGB for JPEG, WebP and AVIF, so small results stay small.
- **Fixes rotation**: the EXIF orientation of phone photos is applied to the pixels, so every result is upright everywhere.
- **Keeps animations** of GIF, WebP and APNG when the output is WebP or GIF, and fills transparency with a colour you choose for JPEG.
- **Reads images from a key-value store** (files you uploaded or the output of another Actor), **from a dataset field** (`images`, `product.imageUrl` ...) or as `data:image/...;base64` URIs, and packs the results into **one ZIP** with a manifest on request.

### Why use it

- **Low price per image.** $1.50 per 1,000 typical images in any format but AVIF ($8 per 1,000 for AVIF, a much slower encoder). A 2-10 MB phone photo costs $0.0015 here and $0.005 at the most used image converter in the Store (21.11.2026), and inputs that are not found or not images are free.
- **Privacy by default.** GPS coordinates in photos reveal where they were taken; they are removed unless you ask to keep them, and the row says whether a location was found.
- **HEIC in, AVIF out.** iPhone photos become JPEG or WebP for any browser or CMS; AVIF gives the smallest files for the web.
- **Respectful.** robots.txt is checked for every image link and redirect, private network addresses are refused. No proxies, no CAPTCHA solving, no login. Only the images you give are read, nothing else is collected.
- **Built for AI agents.** Clear status messages, a predictable price per image, and limited permissions, so it works as a tool in the Apify MCP server.

### How to use

#### In Apify Console

1. Paste image links into **Image URLs**, one per line, or pick a key-value store or a dataset under **More inputs**.
2. Choose the **Output format**, and if you want, a **Quality**, **Max width** and **Max height**, or a **Max file size (KB)**.
3. Leave **Metadata** on *Remove all* to drop EXIF and GPS, or keep EXIF without GPS.
4. Press **Start**. The **Overview** shows the size before and after and a link to each file; the files are in the run's **Storage > Key-value store**, and in `images.zip` when **Also create one ZIP** is on.

#### From an AI agent (MCP)

Connect any MCP client to the Apify MCP server with only this Actor as a tool:

```
https://mcp.apify.com?tools=greenrun/image-converter
```

#### Through the API

```bash
curl -X POST "https://api.apify.com/v2/acts/greenrun~image-converter/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.python.org/static/img/python-logo.png"], "format": "webp", "maxWidth": 1920}'
```

### Input

| Field | Default | Description |
|---|---|---|
| `urls` | | Image links (http, https or `data:` URIs), one per line. `index` keeps the input order. |
| `format` | `webp` | Output: `webp`, `jpeg` (also `jpg`), `png`, `avif`, `gif`, `tiff` (also `tif`). |
| `quality` | | 1-100 for JPEG, WebP and AVIF. Empty: JPEG 85, WebP 80, AVIF 60. |
| `maxWidth` | `0` | Larger images are scaled down to fit; 0 keeps the width. Never enlarges. |
| `maxHeight` | `0` | Same for the height. |
| `maxFileSizeKb` | `0` | Target size per result in KB (1,000 bytes). JPEG, WebP, AVIF: quality down to 40, then dimensions; PNG, GIF, TIFF: dimensions. 0: no target. |
| `metadata` | `remove` | `remove` (EXIF, GPS, XMP, comments), `removeGps` (keep EXIF without GPS), `keep`. |
| `lossless` | `false` | Lossless WebP (screenshots, logos, graphics). |
| `keepAnimation` | `true` | Animated input stays animated when the output is WebP or GIF; otherwise the first frame. |
| `backgroundColor` | `#ffffff` | Fill for transparent areas in JPEG. |
| `zip` | `false` | Also pack all results into `images.zip` with `manifest.csv` (free). |
| `keyValueStoreId` | | Optional key-value store whose image records are converted (JSON and text records are skipped). |
| `keyPrefix` | | Only records whose key starts with this text. |
| `datasetId` | | Optional dataset whose items contain image links. |
| `datasetField` | `url` | Field with the links in each dataset item; dot paths and lists work. |
| `maxInputSizeMb` | `50` | Larger input files are skipped for free (1-500). |
| `maxConcurrency` | `4` | Parallel downloads (1-20). Conversion uses one CPU core per 4 GB of memory. |
| `timeoutSecs` | `60` | Download timeout per image (10-600). Slow downloads stop earlier when they would cost more than the image pays (see Limits). |

### Output

One row per input. Real output from a run on 21.11.2026 (build 0.1.8, `"format": "webp", "maxWidth": 1920, "maxHeight": 1920`), a 12 MP photo from Wikimedia Commons, shortened:

```json
{
  "index": 3,
  "input": "https://upload.wikimedia.org/wikipedia/commons/3/34/120327-021_Mong_La.jpg",
  "source": "url",
  "status": "converted",
  "httpStatus": 200,
  "inputFormat": "jpeg",
  "inputWidth": 4000,
  "inputHeight": 3000,
  "inputBytes": 5153987,
  "frames": 1,
  "format": "webp",
  "width": 1920,
  "height": 1440,
  "sizeBytes": 412870,
  "savedPercent": 92,
  "quality": 80,
  "metadata": "removed",
  "exifFound": true,
  "gpsFound": true,
  "fileName": "120327-021_Mong_La.webp",
  "key": "00003-120327-021_Mong_La.webp",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/1DgJDOybi8wwWrP4R/records/00003-120327-021_Mong_La.webp?signature=...",
  "warnings": [],
  "cpuSeconds": 0.356,
  "computeSeconds": 0.49,
  "billedBy": "pixels",
  "processingMs": 837,
  "error": null,
  "billableEvents": {"image": 1}
}
```

The same run converted an iPhone-style HEIC (1280 x 720, 893 KB to 95 KB) and two PNGs, and returned these rows for free:

```json
{"index": 5, "input": "https://www.rfc-editor.org/rfc/rfc9309.pdf", "status": "unsupported", "error": "Not an image (application/pdf); greenrun/document-to-markdown reads PDFs", "billableEvents": {"image": 0}}
{"index": 6, "input": "https://www.python.org/static/img/does-not-exist.png", "status": "not_found", "httpStatus": 404, "error": "HTTP 404: not found", "billableEvents": {"image": 0}}
```

Status message of that run: `Done: 4 of 6 images converted to WEBP (6.3 MB to 0.6 MB, 91% smaller); 1 not found, 1 not a supported image (not charged, see RUN-REPORT)`.

The `RUN-REPORT` record in the key-value store has the counts, events, bytes before and after, and every free input with its reason.

### Pricing

Pay per event, no subscription:

| Event | Price | When |
|---|---|---|
| Image | $0.0015 | One image converted and stored as JPEG, PNG, WebP, GIF or TIFF, per started 12 MP, 10 MB stored or 10 GB-seconds of conversion, whichever is more (a 12 MP photo is 1). Charged when decoding starts, so a damaged file counts once. Not found, blocked and non-image inputs are free. |
| Image as AVIF | $0.008 | One image converted and stored as AVIF, per started 12 MP, 10 MB stored or 80 GB-seconds of conversion, whichever is more (a 12 MP photo is 1). Charged when decoding starts, so a damaged file counts once. Not found, blocked and non-image inputs are free. |
| Actor start | $0.0045 per GB of memory | Once per run (Apify's standard start event, $0.0045 at the default 1 GB). It pays for the run's fixed costs, including Apify starting the container (up to about 20 s on a new server), and for the time that free inputs (not found, blocked, slow) take. |

**What one event covers.** A typical photo is one event. An image counts more events only when it is large in one of three ways, and then by whichever is largest:

- **Pixels:** one event per started 12 MP of the result (12,582,912 pixels, for example 4096 x 3072 or a 4032 x 3024 phone photo). A 24 MP result is 2 events, a 48 MP result 4; `maxWidth` and `maxHeight` lower the count, so a 48 MP photo resized to 1920 px is 1 event. An animation counts the pixels of all its frames.
- **Storage:** one event per started 10 MB written to or read from Apify storage: the result, its copy in `images.zip` when the ZIP is on, and the input when it is read from your Apify storage (a key-value store or an `api.apify.com` record link, read through the Apify API; a link the API cannot open is downloaded by its public URL and counts 4 times, as its transfer costs 4 times more). This matters for PNG and TIFF of large photos (a 24 MP photo as PNG is about 48 MB).
- **Compute:** one event per started 10 GB-seconds of conversion (10 seconds at the default 1 GB of memory; 80 GB-seconds for AVIF), counted from the start of the conversion until the result is stored, for example a 45 MP HEIC made into a small JPEG or a long animation. More memory makes conversions faster, so the count stays about the same.

Each row says what set its count in `billedBy` (`pixels`, `storage` or `compute`), with `computeSeconds` and `billableEvents`.

Free: inputs that are not found, blocked by robots.txt or refused by the site, not images, too large and failed downloads.

**Charged when the work starts.** An image is charged one event when its decoding starts, each further compute unit when it starts, and its pixel and storage events before the result is stored. So a file that is damaged after a valid header is charged once, and a conversion stopped by an abort, a timeout or the maximum cost of the run keeps what was charged (the row says so). An image in your key-value store that is larger than what the run has already paid for (about 4 MB at the start of a run) pays its storage events before it is read. You can cap the cost of a run with the maximum charge in the run options; the run stops at that limit and the status message says so.

### Limits

- **Memory**: an image must fit in the run's memory while it is converted. At the default 1 GB that is about 20 MP at full size for AVIF, 40 MP for WebP and 55-70 MP for JPEG and PNG (more when the result is resized); larger images are free rows with a hint. Resize them (`maxWidth`) or run with up to 4 GB.
- **Speed** at the default 1 GB (21.11.2026, real 12-24 MP photos): about 6 seconds per 12 MP photo to WebP at full size, 5 seconds to WebP at 1920 px, 40 seconds to AVIF; JPEG, PNG and HEIC input are faster. More memory gives more CPU at the same price per image.
- **WebP** allows at most 16,383 px per side; larger results are scaled down with a warning.
- **Not supported**: SVG and other vector formats, PDF (use greenrun/document-to-markdown), camera RAW files, JPEG XL, upscaling and AI editing.
- **GIF and TIFF** results keep no EXIF metadata. Animated input becomes one frame unless the output is WebP or GIF.
- **Large sources are read as they pay.** A dataset or a key-value store is read page by page while its images pay for the reading, so a dataset without links in `datasetField` stops after a few hundred items with a clear message instead of being read to the end.
- **Each image is worked on in its own process**, stopped when the charges stop paying for it (for example a file whose header takes very long to read before anything is charged). An image that runs out of memory fails alone, not the whole run.
- **Runs of mostly dead or slow links stop early.** Failed inputs are free, so their run time is paid by the Actor start and the converted images. Once that is used up, downloads in progress stop, the remaining inputs are skipped and the status message says so (`stoppedBecause: "cost"` and the list in `notProcessedInputs` in `RUN-REPORT`).
- **Animations** up to 1,000 frames; **target file size** within 12 encoder runs (if the target cannot be reached, the smallest result is returned with a warning).
- **Downloads** time out after `timeoutSecs` (60 s by default) and 20 s without data. A download also stops when waiting longer would cost more than its image pays: after about 21 s at the default 1 GB of memory (115 s for AVIF), less with more memory, not counting robots.txt `Crawl-delay` pauses. Such a row is free and says so; for very slow hosts, put the files into a key-value store and use `keyValueStoreId`.
- **Files you give only.** The Actor converts the images you link or store; it does not crawl pages for images (use greenrun/website-image-downloader for that). You are responsible for having the right to process the images, including any personal data in them.

### FAQ

**Do you keep the images?** No. Results stay in your run's dataset and key-value store in your own Apify account, under your data retention settings.

**Why was an image not charged?** Each free result has its reason in the `error` field, and the `RUN-REPORT` record in the key-value store counts them.

**Which libraries does it use?** Pillow (with libjpeg-turbo, libwebp and libavif) and pi-heif (libheif and libde265, LGPL-3.0, decoding only).

**Something is wrong with a result?** Open an issue on the Actor's **Issues** tab with the input.

# Actor input Schema

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

Public http or https links to images (JPEG, PNG, WebP, AVIF, HEIC, GIF, TIFF, BMP), one per line. data:image/...;base64 URIs work too. Each image becomes one row; the index field keeps the input order.

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

WebP and AVIF give the smallest files for the web (AVIF is smaller but slower and priced as 'image-avif'). JPEG for compatibility, PNG and TIFF lossless, GIF for simple animations.

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

For JPEG, WebP and AVIF. Leave empty for the format's default: JPEG 85, WebP 80, AVIF 60. Lower means smaller files.

## `maxWidth` (type: `integer`):

Larger images are scaled down to fit, keeping the aspect ratio; smaller ones are never enlarged. 0 keeps the width.

## `maxHeight` (type: `integer`):

Larger images are scaled down to fit, keeping the aspect ratio. 0 keeps the height.

## `maxFileSizeKb` (type: `integer`):

Target size of each result, in kilobytes (1 KB = 1,000 bytes). JPEG, WebP and AVIF lower the quality first (down to 40), then the dimensions; PNG, GIF and TIFF lower only the dimensions. 0 means no target.

## `metadata` (type: `string`):

Remove all: EXIF, GPS location, XMP and comments are removed (the colour profile stays). Keep EXIF without GPS: camera and date stay, location goes. Keep: EXIF and XMP as they are. The rotation from EXIF is always applied to the pixels.

## `lossless` (type: `boolean`):

WebP without any quality loss, good for screenshots, logos and graphics; photos get much larger. PNG, GIF and TIFF are always lossless.

## `keepAnimation` (type: `boolean`):

Animated GIF, WebP, PNG (APNG) and AVIF stay animated when the output is WebP or GIF. Other outputs, or this switch off, take the first frame.

## `backgroundColor` (type: `string`):

JPEG has no transparency: transparent areas are filled with this colour, as #rrggbb.

## `zip` (type: `boolean`):

Pack every converted image into images.zip in the key-value store, with manifest.csv. The ZIP itself is free.

## `keyValueStoreId` (type: `string`):

Also convert the images stored in this key-value store, for example files you uploaded or the output of another Actor. JSON and text records are skipped.

## `keyPrefix` (type: `string`):

Convert only the records of the key-value store whose key starts with this text. Empty: all records.

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

Also convert the image links found in this dataset, for example the output of a scraper. Pick the field below.

## `datasetField` (type: `string`):

Field of each dataset item that holds the image link. Dot paths and lists work: url, images, images.url, product.imageUrl.

## `maxInputSizeMb` (type: `integer`):

Larger images are skipped for free.

## `maxConcurrency` (type: `integer`):

How many images are downloaded at the same time. Conversion uses one CPU core per 4 GB of memory.

## `timeoutSecs` (type: `integer`):

A download that takes longer fails for free. A download also stops when waiting longer would cost more than its image pays: after about 21 s at 1 GB of memory (115 s for AVIF), less with more memory.

## Actor input object example

```json
{
  "urls": [
    "https://www.python.org/static/img/python-logo.png",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "format": "webp",
  "maxWidth": 0,
  "maxHeight": 0,
  "maxFileSizeKb": 0,
  "metadata": "remove",
  "lossless": false,
  "keepAnimation": true,
  "backgroundColor": "#ffffff",
  "zip": false,
  "datasetField": "url",
  "maxInputSizeMb": 50,
  "maxConcurrency": 4,
  "timeoutSecs": 60
}
```

# Actor output Schema

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

No description

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

No description

## `zip` (type: `string`):

No description

## `report` (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://www.python.org/static/img/python-logo.png",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("greenrun/image-converter").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://www.python.org/static/img/python-logo.png",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("greenrun/image-converter").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://www.python.org/static/img/python-logo.png",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ]
}' |
apify call greenrun/image-converter --silent --output-dataset

```

## MCP server setup

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

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/zaYbqInCZhlquRsoj/builds/0RwBCkYUgUkc22vsr/openapi.json
