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

Convert and compress images in bulk from URLs or a dataset: WebP, AVIF, JPEG or PNG, resize, remove EXIF and GPS. Public file links, size saved per image, failed links free with the reason. $2.50 per 1,000 images up to 5 MP.

- **URL**: https://apify.com/tagadanar/image-converter.md
- **Developed by:** [Tagada Data](https://apify.com/tagadanar) (community)
- **Categories:** Developer tools, E-commerce, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.75 / 1,000 image converted (per 5 mp)s

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

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

Paste image links, or point at a dataset from a product or image scraper, and get every image back converted, compressed and resized: WebP, AVIF, JPEG or PNG, with camera data and GPS location removed. Each new file is saved in the run's key-value store with a public link, and you get one dataset row per image: formats, width and height before and after, bytes before and after, and the percentage saved. Links that fail get a named reason instead of disappearing, and are free.

For e-commerce catalogues, site-speed work (WebP and AVIF for Core Web Vitals), and data pipelines that end in an Apify dataset. No API key, no proxy, nothing to install.

**Price: $2.50 per 1,000 images up to 5 megapixels** on the free plan ($1.75 on Gold), plus $0.001 per run. Bigger images count one more image per started 5 MP of the result. Files over 2 MB add $0.0003 per extra MB. Failed links and unsupported files are free. Platform usage is included.

| One image | counts as | costs (free plan) |
| --- | --- | --- |
| 2000 x 2000 product photo to WebP | 1 | $0.0025 |
| 12 MP phone photo (4032 x 3024) resized to 1920 px | 1 | $0.0025 |
| 12 MP phone photo kept at full size | 3 | $0.0075 |
| 24 MP camera photo resized to 1920 px | 2 | $0.005 |
| 480 x 360 animated GIF, 36 frames, to animated WebP | 2 | $0.005 |
| 12 MP photo saved as a 25 MB PNG | 3 + 23 extra MB | $0.0144 |

The exact rule: one image unit per started 5 megapixels of the result (all frames of an animation add up), and at least one per started 20 megapixels of the original (5 for AVIF originals, which are slow to decode).

### Input

| Field | What it does |
| --- | --- |
| **Image URLs** (`imageUrls`) | Direct image links, one per line. Objects like `{"url": "..."}` also work; repeated links are converted once |
| **Dataset** (`datasetId`) + **field** (`datasetUrlField`, default `url`) | Take the links from a dataset in your account. Dotted paths and lists work: `imageUrl`, `images`, `images.0.url`, `media.url` |
| **Output format** (`outputFormat`) | `webp` (default), `avif`, `jpeg`, `png`, or `keep` (same format as the original: GIF becomes WebP, TIFF stays TIFF, SVG becomes PNG) |
| **Quality** (`quality`) | 1-100 for JPEG, WebP and AVIF. Empty = the format's default: JPEG 80, WebP 80, AVIF 50. AVIF uses at most 90 |
| **Remove metadata** (`stripMetadata`) | On by default: EXIF, GPS position, camera data, captions and editing history are removed and colours are converted to standard sRGB. Photos are turned upright first |
| **Keep animation** (`keepAnimation`) | On by default: animated GIF and WebP stay animated as WebP. JPEG, PNG and AVIF get the first frame |
| **Max width / Max height** (`maxWidth`, `maxHeight`) | Shrink images larger than this box. Empty or 0 = no limit |
| **Fit** (`fit`) | `inside` (default, nothing cropped), `cover` (fill the box exactly, crop from the centre), `contain` (exactly the box, padded) |
| **Enlarge smaller images** (`allowEnlarge`) | Off by default: images smaller than the box keep their size. SVG is drawn directly at the final size, so it stays sharp |
| **Background colour** (`background`) | Fills transparency in JPEG results and the padding of `contain` for JPEG; `#ffffff` by default |
| **Max images** (`maxImages`) | 1,000 by default, 10,000 per run |
| **Max original size** (`maxInputMb`) | 50 MB by default, 100 max |

Example: a product catalogue to WebP, at most 1600 px:

```json
{
    "datasetId": "YOUR_SCRAPER_DATASET_ID",
    "datasetUrlField": "images",
    "outputFormat": "webp",
    "quality": 80,
    "maxWidth": 1600,
    "maxHeight": 1600
}
```

Example: square thumbnails, cropped:

```json
{
    "imageUrls": ["https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg"],
    "outputFormat": "avif",
    "maxWidth": 400,
    "maxHeight": 400,
    "fit": "cover"
}
```

### Output

One row per link:

```json
{
    "url": "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
    "status": "CONVERTED",
    "errorCode": null,
    "reason": null,
    "key": "Felis_catus-cat_on_snow-4d9cbd65c9.webp",
    "fileUrl": "https://api.apify.com/v2/key-value-stores/…/records/Felis_catus-cat_on_snow-4d9cbd65c9.webp?signature=…",
    "inputFormat": "jpeg",
    "outputFormat": "webp",
    "inputWidth": 3000,
    "inputHeight": 2000,
    "width": 1920,
    "height": 1280,
    "frames": 1,
    "inputBytes": 2125399,
    "outputBytes": 197410,
    "savedPercent": 90.7,
    "units": 1,
    "quality": 80,
    "metadataRemoved": true,
    "finalUrl": "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
    "convertedAt": "2026-11-12T11:06:15.003Z"
}
```

- `status` is `CONVERTED`, `SKIPPED_SAME` or `FAILED`. `SKIPPED_SAME` means the original was already smaller than any re-encoding in the same format and size, with no metadata to remove: the original bytes are stored as they were (charged like a conversion, since the work was done and the file is in the store).
- `fileUrl` is a signed public link to the new file: it opens without an Apify token, so you can hand it to a teammate, a spreadsheet or a CMS import. The files stay in the run's key-value store for your plan's data-retention period.
- `key` is stable: the same link and format always get the same key, built from the link's file name and a short hash.
- `width` and `height` are of one frame; `inputWidth` and `inputHeight` are the original as it displays (turned upright).

#### Formats

| Original | Read | Notes |
| --- | --- | --- |
| JPEG, PNG, WebP, AVIF, TIFF | yes | first page of a multi-page TIFF |
| GIF | yes | animated GIFs stay animated as WebP |
| SVG | yes | drawn as pixels; files and links inside the SVG are not loaded |
| HEIC / HEIF (iPhone photos) | no | `unsupported-format`: export as JPEG first |
| BMP, ICO, JPEG XL, PSD, PDF | no | `unsupported-format` or `not-an-image` |

Results: WebP (animated too), AVIF, JPEG (progressive), PNG, and TIFF for `keep` on a TIFF original. Images are limited to 50 megapixels (all frames of an animation together), AVIF results to 36 megapixels and WebP results to 16,383 pixels a side; anything larger fails free with the reason and a hint (set a max width or height).

#### Named reasons (`errorCode`, free)

| Code | Meaning |
| --- | --- |
| `not-found` | HTTP 404 or 410 |
| `refused` | 401/403/429 after retries, the host does not resolve, the connection failed, or the host had already left 3 links in a row unanswered in this run (the rest of its links are then not tried) |
| `server-error` | HTTP 5xx after retries |
| `http-error` | another HTTP error |
| `timeout` | the download did not finish in time |
| `too-large` | over your max original size |
| `too-many-pixels` | over the megapixel limit (or the AVIF result limit) |
| `not-an-image` | a web page (often a login or error page), a PDF or unknown bytes |
| `unsupported-format` | HEIC, BMP, ICO, JPEG XL, PSD |
| `corrupt` | the image could not be decoded (truncated or damaged file) |
| `encode-failed` | the result could not be written in that format (size limit of the format) |
| `conversion-timeout` | the conversion took too long and was stopped |
| `blocked-address` | the link points to a private, loopback or cloud-metadata address (refused for safety, on every redirect too) |
| `bad-url`, `too-many-redirects`, `empty-file`, `upload-failed` | not a usable link, a redirect loop, 0 bytes, or the store refused the file |

The run's status message sums it up: how many images were converted, the bytes before and after, and which links failed for which reason. A run where every link failed for a proven reason (404, not an image...) ends as succeeded with 0 images; a run where nothing could be fetched (refused, timed out) ends as failed so you can retry it.

### How it works

- The run downloads each image directly (no proxy) with a user agent naming this actor. A link that is rate-limited (429) or hits a server error is tried up to 3 times, following the server's `Retry-After`; a host that does not answer at all is tried twice. After 3 links in a row from one host got no answer, the rest of that host's links fail at once with the reason, so a dead host does not hold the run up.
- Every hostname is resolved and checked before connecting, and again on each redirect: private, loopback, link-local and metadata addresses are refused.
- Conversion uses libvips (the sharp library). Encoders are tuned for batch speed: AVIF at speed 0 (fastest), WebP at effort 2, JPEG with progressive scans and the mozjpeg quantisation tables, PNG at maximum compression.
- The pixel count is checked from the file header before anything is decoded, so a "decompression bomb" (a tiny file that claims a huge image) fails free without filling the memory.

### Limits

- Links that need a login or cookies (Google Drive previews, Dropbox pages) return a web page, not the image: they are reported as `not-an-image`. Use the direct file link.
- No HEIC/HEIF input (the HEVC codec is not included).
- One run handles up to 10,000 links; split bigger lists.

### FAQ

**Can it convert every image on a web page?** Give it the image links. Pair it with a scraper that outputs image URLs and point "Dataset" at that scraper's dataset.

**Where are my files?** In the run's key-value store (Storage tab of the run), each with a public `fileUrl` in the dataset.

**Is a failed link charged?** No. Only converted images are charged, plus $0.001 per run.

**WebP or AVIF?** WebP opens everywhere and converts fast. AVIF gives smaller files for photos and takes longer to make.

**Does it keep transparency?** Yes for WebP, AVIF and PNG. JPEG has no transparency: transparent areas are filled with the background colour.

### Data use

The actor only reads the links you give it and stores the results in your own Apify storage. With "Remove metadata" on (the default), location and camera data never reach the new files.

# Changelog

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

# Actor input Schema

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

Direct links to the images to convert: JPEG, PNG, WebP, AVIF, GIF (animated too), TIFF or SVG. One URL per line. Each converted file is saved in the run's key-value store with a public link.

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

A dataset in your account, for example the output of a product or image scraper (pick it or paste its ID). The image URLs are read from the field below and added to the list above.

## `datasetUrlField` (type: `string`):

Field name in each dataset item. Dotted paths and lists work: "imageUrl", "images", "images.0.url", "media.url".

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

WebP: small files every browser shows. AVIF: the smallest files, slower to make. JPEG: works everywhere. PNG: lossless, keeps transparency. Keep: same format as the original (GIF becomes WebP, TIFF stays TIFF, SVG becomes PNG).

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

For JPEG, WebP and AVIF. Lower = smaller files. Empty = the format's own default (JPEG 80, WebP 80, AVIF 50). AVIF uses at most 90. Ignored for PNG and TIFF (lossless).

## `stripMetadata` (type: `boolean`):

On: camera data, GPS position, captions and editing history are removed and colours are converted to standard sRGB. Photos are turned upright first, so they still display the right way. Off: metadata is copied to the new file.

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

Animated GIF and WebP stay animated when the output is WebP (or Keep). Off, or with JPEG, PNG and AVIF output: the first frame only.

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

Shrink images wider than this. Empty or 0 = no limit. Aspect ratio is kept with the "inside" fit.

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

Shrink images taller than this. Empty or 0 = no limit.

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

Inside: fits within max width x max height, nothing cropped. Cover: fills exactly that box, cropping the overflow from the centre (needs both sizes). Contain: exactly that box, padded with the background colour (transparent for WebP, AVIF and PNG).

## `allowEnlarge` (type: `boolean`):

Off: images smaller than the box keep their size. On: they are scaled up to it (adds no detail to photos; SVG is drawn directly at that size, so it stays sharp).

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

Fills transparent areas when the output is JPEG (which has no transparency), as #rrggbb.

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

Stop after this many links (at most 10,000 per run).

## `maxInputMb` (type: `integer`):

Originals larger than this are skipped (free) with the reason. Images are also limited to 50 megapixels.

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    "https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif",
    "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
  ],
  "datasetUrlField": "url",
  "outputFormat": "webp",
  "stripMetadata": true,
  "keepAnimation": true,
  "maxWidth": 1920,
  "fit": "inside",
  "allowEnlarge": false,
  "background": "#ffffff",
  "maxImages": 1000,
  "maxInputMb": 50
}
```

# Actor output Schema

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

One row per link: status, formats, sizes, bytes saved and the public link of the converted file.

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

The key-value store holding the converted 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://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
        "https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif",
        "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
    ],
    "maxWidth": 1920
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/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 = {
    "imageUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
        "https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif",
        "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg",
    ],
    "maxWidth": 1920,
}

# Run the Actor and wait for it to finish
run = client.actor("tagadanar/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 '{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    "https://upload.wikimedia.org/wikipedia/commons/d/d3/Newtons_cradle_animation_book_2.gif",
    "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
  ],
  "maxWidth": 1920
}' |
apify call tagadanar/image-converter --silent --output-dataset

```

## MCP server setup

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