# Bulk Image Converter: WebP, AVIF, Resize \[USD 1/1K] (`usefulapi/bulk-image-converter`) Actor

Convert images in bulk to WebP, AVIF, JPEG or PNG from links, a dataset or stored files. Resize, set quality or a target file size, strip metadata; SVG, GIF, TIFF, BMP and AVIF in. USD 1 per 1,000 images, plus USD 0.0001 per extra megapixel and 0.0002 per extra MB.

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

## Pricing

from $1.00 / 1,000 image converteds

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

## Bulk Image Converter: WebP, AVIF, JPEG, PNG, resize

Convert images in bulk. Give it image links, a dataset of links, or a key-value store of images; get WebP, AVIF, JPEG or PNG files back, resized if you ask, with one row per image (formats, pixel sizes, bytes in and out, percent saved) and one signed ZIP link. **USD 1 per 1,000 images**, plus a small amount per extra megapixel and per extra megabyte (see Pricing).

### What it does

- **Reads** JPEG, PNG, WebP, AVIF, GIF (animated too), TIFF, BMP and SVG. The format is read from the file's bytes, not from the link or the server's Content-Type.
- **Writes** WebP, AVIF, JPEG or PNG. PNG is lossless (pixel for pixel) unless you turn on the 256-colour palette; greyscale JPEG and PNG stay greyscale, and a 16-bit PNG stays 16-bit as PNG (other outputs are 8-bit).
- **Options**: quality (or lossless for WebP and AVIF), resize by max width and max height with five fit modes (no enlargement unless you ask), strip metadata (on by default: removes EXIF, GPS, colour profile) or keep it, apply the EXIF rotation, background colour for transparency when writing JPEG, a **target file size** (the quality is searched, best first, in at most 8 encodings), PNG palette mode, SVG scale, animated GIF kept as animated WebP.
- **Safe by default**: a size cap per file (25 MB, hard limit 100 MB), a pixel cap (50 megapixels, hard limit 100), a time cap per image, a memory check from the image header and a watch on the converter's real memory, so one huge file can never end the run. A bad link is a row with a status, never a failed run.
- **Conversion runs in the cloud**, files go to a key-value store made for the run, with a signed link for each file and a signed ZIP of all of them (valid 7 days, no login needed; the store itself is deleted after your plan's data retention, 7 days on most plans).

### Input example

```json
{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/6/69/MarsSunset.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/e/e3/Snow_crystals.png"
  ],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1600,
  "stripMetadata": true
}
```

Other inputs: `datasetId` (+ `datasetUrlField`, for example the dataset of the [Bulk Image Downloader](https://apify.com/usefulapi/bulk-image-downloader): its `fileUrl` or `imageUrl` field is found automatically; rows without a link are listed and skipped), `keyValueStoreId` (+ `keyPrefix`) for images already stored in a key-value store of yours, `targetMaxKb`, `lossless`, `avifEffort` (0 to 2), `fit`, `allowEnlargement`, `background`, `animation`, `svgScale`, `maxFileSizeMb`, `maxMegapixels`, `timeoutSecs`, `retries`, `concurrency`, `maxInputs`. The input form has the full descriptions.

### Output example (one row, real run of 19 Nov 2026 on build 1.0.17, trimmed)

```json
{
  "status": "ok",
  "input": "https://raw.githubusercontent.com/recurser/exif-orientation-examples/master/Landscape_6.jpg",
  "inputFormat": "jpeg",
  "inputWidth": 1200, "inputHeight": 1800,
  "outputFormat": "webp",
  "outputWidth": 1800, "outputHeight": 1200,
  "inputBytes": 352727, "outputBytes": 335624, "percentSaved": 4.8,
  "quality": 80, "qualityTries": 1,
  "frames": 1, "hasAlpha": false, "megapixelsIn": 2.16,
  "key": "converted__Landscape_6-9b344e9f.webp",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/<store>/records/converted__Landscape_6-9b344e9f.webp?signature=...",
  "zipUrl": "https://api.apify.com/v2/key-value-stores/<store>/records?prefix=converted__&signature=...",
  "billedAs": { "event": "image-converted", "megabytes": 0 }
}
```

This photo was stored rotated (EXIF orientation 6); the output is upright. The run summary (record `OUTPUT`) has counts by status, the billed events, the ZIP link and why a run stopped early, if it did.

**Statuses**: `ok`, `not_found`, `forbidden`, `rate_limited`, `server_error`, `unreachable`, `timeout`, `too_slow`, `tls_error`, `dns_not_found`, `private_address`, `blocked_port`, `too_large` (over your file size cap), `too_many_pixels` (over your pixel cap or what the run's memory can convert), `memory_limit` (the conversion needed more memory than the run has), `output_too_large` (WebP is limited to 16,383 px a side), `not_an_image`, `unsupported_format`, `corrupt_image`, `convert_failed`, `cost_limit`, `store_failed`, `invalid_input`.

### Pricing (pay per event)

| Event | Price |
|---|---|
| Run start (per GB; the Actor uses 2 GB) | USD 0.0025 per GB, USD 0.005 per run |
| Image converted | USD 0.001 |
| Link or file without a converted image (broken, not an image, HEIC, over a cap, timeout) | USD 0.0002 |
| Each started megabyte beyond the first of an input file, or of the converted file when it is larger | USD 0.0002 |
| Each started megapixel beyond the first of the image worked on: the input, or the output when it is larger (enlarging, SVG drawn at its output size); every frame of an animation counts; palette PNG output also counts its output megapixels | USD 0.0001 |
| Each started megapixel of AVIF output (every encoding pass) | USD 0.0002 |

Worked examples: a 12.05 MB, 23.3 megapixel phone photo converted to WebP costs 0.001 + 12 x 0.0002 + 23 x 0.0001 = **USD 0.0057**; to AVIF, + 24 x 0.0002 = USD 0.0105. A run of one small image costs 0.005 + 0.001 = USD 0.006, a thousand thumbnails under 1 MB and 1 megapixel USD 1.005. Lossless PNG of a photo is often larger than the JPEG it came from: a 5.2 MB, 15.9 megapixel JPEG gave a 29.4 MB PNG, billed 0.001 + 29 x 0.0002 + 15 x 0.0001 = USD 0.0083 (the megabytes of the larger file). Measured platform cost is a few hundredths of a cent per web-size image (details and run ids in the repository's PRICING.md). Set your maximum cost per run: the Actor stops cleanly before it passes it (rows already converted are kept, an image stopped part way is a `cost_limit` row, and the inputs not started are counted in `OUTPUT` as `inputsNotStarted`, so you can run them again). With the target-size option each extra encoding pass is billed as megapixels, and reserved against your limit first. A file that fails while it is being converted (damaged, timeout, memory) is billed as a link without a converted image plus the megapixels reserved for it.

### Limits (honest)

- **HEIC and HEIF photos (iPhone) cannot be read**: the image library has no HEVC decoder. AVIF files can. ICO, JPEG XL and compressed (RLE) BMP files are refused with a clear status. PDF and RAW camera files are not images here.
- Direct file links are downloaded as given (no web page is read and robots.txt is not consulted), on ports 80, 443, 8080 and 8443 only; to find the images on a page use the Bulk Image Downloader first and pass its dataset id.
- A server slower than 1 MB/s after an 8 s allowance is stopped (`too_slow`); in a very small run a slow failed download may not be retried.
- **Certificates are verified**: a site with an invalid or expired certificate is the status `tls_error` and its file is not read.
- AVIF is slow to encode: effort is limited to 0 to 2 (default 2). On Apify's servers effort 3 took 45 seconds for a 4.6 megapixel image against 2 seconds for effort 2, so it is not offered.
- AVIF output is limited by the run's memory to about 50 megapixels (other formats about 90; these are estimates from measured peaks: a 48 megapixel photo to AVIF used 1,056 MB, to WebP 404 MB); WebP to 16,383 px a side. Larger images get `too_many_pixels` or `output_too_large` before the file is downloaded further; resize with a smaller source or choose JPEG or PNG.
- Animated GIF stays animated only as WebP. JPEG, PNG and AVIF output use the first frame (`framesDropped` says how many were left out). TIFF with several pages: first page.
- CMYK JPEGs are converted to sRGB with their embedded profile; a CMYK sample we compared with Apple's own decoder differed by about 4 levels in the mean red value (24 against 28 of 255). A truncated file that cannot be read is `corrupt_image`.
- SVG: external references (links, @import, scripts, external entities) are removed before drawing (plain text entities, as Illustrator writes them, are kept); the file is drawn at 2x its own size unless you set max width or height (never above 4,096 px a side without them), and its megapixels are billed on the size it is drawn at.
- Metadata: with "Strip metadata" on (default) EXIF, XMP and the colour profile are removed; the colours are converted to sRGB first. Turn it off to keep them.
- No email addresses or phone numbers are put in error messages or echoed input (they are replaced by "\[removed]").
- Files are stored in an unnamed store that expires after your plan's retention period (7 days on most plans); download the ZIP or copy the files before then.
- A conversion that takes longer than its time cap is stopped and reported as `timeout` (billed as a link without a converted image plus its reserved megapixels).

### FAQ

**Is the original file kept?** No. Only converted files are stored; the input is read once and deleted from the run's disk.
**Can it convert images I already stored in Apify?** Yes: pass the id of the key-value store (every image record is converted, `INPUT`, `OUTPUT` and `STATE` skipped) or of a dataset with links.
**How do I get under 100 KB per image?** Set `targetMaxKb` to 100 with JPEG, WebP or AVIF; the row says if the target could not be reached (and at which quality).
**How is the ZIP made?** Apify serves every record whose key starts with `converted__` as one ZIP through the signed link in `OUTPUT` (and in each row).

### Related Actors

- [Bulk Image Downloader](https://apify.com/usefulapi/bulk-image-downloader): find and download every image of web pages, then pass the dataset id here.
- [Favicon and Brand Assets Extractor](https://apify.com/usefulapi/favicon-logo-extractor).
- [PDF Text, OCR and Tables](https://apify.com/usefulapi/pdf-text-ocr).

# Actor input Schema

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

One link per line to an image file (JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP, SVG). Links are downloaded as given (no page is read, no robots.txt), on ports 80, 443, 8080 and 8443 only. The format is read from the file's bytes, not its extension. Up to 20,000 inputs per run.

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

ID of a dataset of yours with one image link per item, for example the dataset of the Bulk Image Downloader Actor. The link is taken from the field below, or from the first of fileUrl, imageUrl, url, image, src, link that holds a link.

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

Name of the field that holds the image link, e.g. fileUrl or photo.src. Empty = automatic.

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

ID of a key-value store of yours whose records are images. Every record is converted (INPUT, OUTPUT and STATE are skipped when no prefix is set).

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

Convert only the records whose key starts with this text.

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

Every image is converted to this format.

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

Empty = 80 for WebP and JPEG, 60 for AVIF. PNG is lossless unless you turn on the palette option. Ignored when Lossless is on.

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

Lossless WebP or AVIF: no quality loss, larger files.

## `pngPalette` (type: `boolean`):

Smaller PNG files by quantising to a palette of 256 colours (lossy); the quality setting then controls the loss. Off: PNG output is lossless, greyscale stays greyscale and 16-bit stays 16-bit.

## `avifEffort` (type: `integer`):

Higher is smaller and slower. Limited to 2: on Apify's servers effort 3 took about 45 s for a 4.6 megapixel image where effort 2 took 2 s. The price is the same for every value.

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

Empty = keep the size.

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

Empty = keep the size.

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

How an image is fitted into Max width and Max height. Inside never crops.

## `allowEnlargement` (type: `boolean`):

Off: an image smaller than the box keeps its size.

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

Removes EXIF (camera, GPS), XMP and colour profile. Turn off to keep them.

## `autoRotate` (type: `boolean`):

Turns photos upright from their EXIF orientation.

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

Fills transparency when converting to JPEG, and padding for the contain fit. Format #rgb or #rrggbb.

## `targetMaxKb` (type: `integer`):

The quality is searched (best first) so the file is at or under this size. Works with lossy output only (JPEG, WebP, AVIF, PNG with palette). Every extra encoding pass is billed as megapixels. If it cannot be reached, the row says so.

## `targetMaxTries` (type: `integer`):

At most this many encodings per image while searching for the target size (the first one included).

## `animation` (type: `string`):

Only WebP can keep an animation here; JPEG, PNG and AVIF output always use the first frame (the row says how many frames were dropped).

## `svgScale` (type: `integer`):

SVG files are drawn at this multiple of their own size when you set no max width or height (never above 4096 px). The megapixels are billed on the size the SVG is drawn at.

## `maxFileSizeMb` (type: `integer`):

Larger files are not downloaded (cheap row). Hard limit 100 MB.

## `maxMegapixels` (type: `integer`):

Images with more pixels (all frames of an animation) are refused. The run's memory limits AVIF output to about 50 megapixels and other formats to about 90.

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

Ceiling for one conversion. The time a conversion may take is a 5 s allowance plus what its megapixel events pay for (about 0.7 s per megapixel and 1.4 s more per AVIF megapixel), so a large image gets the time it needs, up to this ceiling. A conversion over its time is stopped and the row says so.

## `retries` (type: `integer`):

Retries of a download that failed for a reason a retry can fix (no answer, too slow, server error). In a very small run a slow failed download may not be retried: each retry is reserved against what the run has earned first.

## `concurrency` (type: `integer`):

Images downloaded at the same time (conversion has its own limit set by the run's memory).

## `maxInputs` (type: `integer`):

The run stops reading inputs after this many.

## Actor input object example

```json
{
  "urls": [
    "https://upload.wikimedia.org/wikipedia/commons/6/69/MarsSunset.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/e/e3/Snow_crystals.png"
  ],
  "outputFormat": "webp",
  "lossless": false,
  "pngPalette": false,
  "avifEffort": 2,
  "fit": "inside",
  "allowEnlargement": false,
  "stripMetadata": true,
  "autoRotate": true,
  "background": "#ffffff",
  "targetMaxTries": 6,
  "animation": "keep",
  "svgScale": 2,
  "maxFileSizeMb": 25,
  "maxMegapixels": 50,
  "timeoutSecs": 120,
  "retries": 1,
  "concurrency": 10,
  "maxInputs": 20000
}
```

# Actor output Schema

## `images` (type: `string`):

No description

## `details` (type: `string`):

No description

## `summary` (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://upload.wikimedia.org/wikipedia/commons/6/69/MarsSunset.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/e/e3/Snow_crystals.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("usefulapi/bulk-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://upload.wikimedia.org/wikipedia/commons/6/69/MarsSunset.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/e/e3/Snow_crystals.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("usefulapi/bulk-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://upload.wikimedia.org/wikipedia/commons/6/69/MarsSunset.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/e/e3/Snow_crystals.png"
  ]
}' |
apify call usefulapi/bulk-image-converter --silent --output-dataset

```

## MCP server setup

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