# Bulk Image Optimizer: WebP, AVIF Converter & Compressor (`actose/bulk-image-optimizer`) Actor

Compress, resize and convert images in bulk from URLs to WebP, AVIF, JPEG or PNG. Get download links, sizes before/after, % saved, dimensions. No API key, no login. MCP-ready for Claude, Cursor, ChatGPT. Pay per result, no monthly rental. Errors are free. $2 per 1,000 images.

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

## Pricing

from $1.70 / 1,000 image optimizeds

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

## Bulk Image Optimizer: WebP, AVIF Converter & Image Compressor API

**$2 per 1,000 images. Failed, broken and duplicate URLs are free. No subscription, no API key.**

Give it a list of image URLs, get back optimized files: **compressed, resized and converted to WebP, AVIF, JPEG or PNG**, each with a download link, the original and new size in bytes, the % saved and the final dimensions. Built for e-commerce catalogs, agencies and developers who need lighter images for Core Web Vitals, without installing ImageMagick, sharp or a CLI.

- 🖼️ **Formats in:** JPEG, PNG, WebP, AVIF, GIF (first frame), TIFF, BMP, HEIC/HEIF (iPhone photos)
- 📦 **Formats out:** WebP, AVIF, JPEG (progressive, optimized), PNG (lossless or palette-reduced), or "keep original format"
- 📐 **Resize:** max width / max height (never upscales), exact-size crop (`cover`) or letterbox (`contain`)
- 🎯 **Smart defaults:** EXIF orientation applied, ICC color profile kept, EXIF/GPS stripped (optional), transparency flattened on the color you choose for JPEG
- 🔁 **`onlyNew` mode** for scheduled runs: only new catalog images are processed and billed
- 🤖 **MCP-ready** for Claude, Cursor, ChatGPT and other AI agents

### How much does it cost?

Pay per result: **$0.002 per optimized image** (event `image-processed`). No monthly rental.

| Volume | Price |
|---|---|
| 100 images | $0.20 |
| 1,000 images | **$2.00** |
| 10,000 images | $20.00 |

**Free:** invalid URLs, 404s, timeouts, non-image files, duplicates in the same run, and images skipped by `onlyNew`.

**Very large images** count as more than one image, so normal catalog photos stay cheap: one image = up to **2 MB downloaded**, up to **4 megapixels in output** (≈ 2000 × 2000 px) and up to **24 megapixels in the source**. A 6 MB DSLR photo counts as 3. A typical product photo (300 KB–2 MB, resized to 1200–2000 px) always counts as 1. The `billedUnits` field of each result tells you exactly what was charged.

Your spending limit is respected: when it is reached, the run stops cleanly and nothing more is delivered or billed.

### Input

```json
{
  "imageUrls": [
    "https://picsum.photos/id/433/2400/1600.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1200
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `imageUrls` | array of strings | — | Public image URLs (required) |
| `outputFormat` | `webp` · `avif` · `jpeg` · `png` · `original` | `webp` | Output format |
| `quality` | 1–100 | 80 | WebP / AVIF / JPEG quality |
| `maxWidth`, `maxHeight` | integer | none | Max size in px (proportions kept, never upscaled) |
| `fit` | `inside` · `cover` · `contain` | `inside` | `cover` = crop to exact size, `contain` = pad to exact size (needs both max width and height) |
| `lossless` | boolean | false | Lossless WebP / AVIF |
| `pngColors` | 2–256 | none | Palette-reduce PNG output (pngquant-like, 50–80% smaller) |
| `backgroundColor` | hex | `#ffffff` | Fill for transparency in JPEG and for `contain` padding |
| `keepMetadata` | boolean | false | Keep EXIF (camera, date, GPS) |
| `onlyNew` | boolean | false | Skip URLs already optimized with the same settings in earlier runs |
| `storeName` | string | run store | Named key-value store to keep the files indefinitely |
| `maxConcurrency` | 1–16 | 4 | Parallel downloads |
| `maxInputSizeMb` | 1–50 | 25 | Skip heavier source files |

### Output

One dataset item per image. The file itself is in the key-value store; `fileUrl` is a direct download link.

```json
{
  "sourceUrl": "https://picsum.photos/id/433/2400/1600.jpg",
  "status": "ok",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/aBcD1234/records/1600-3f9a1c2b7d.webp",
  "fileKey": "1600-3f9a1c2b7d.webp",
  "format": "webp",
  "contentType": "image/webp",
  "originalFormat": "jpeg",
  "originalBytes": 412876,
  "outputBytes": 71230,
  "savedBytes": 341646,
  "savedPercent": 82.7,
  "originalWidth": 2400,
  "originalHeight": 1600,
  "width": 1200,
  "height": 800,
  "quality": 80,
  "hasAlpha": false,
  "wasAnimated": false,
  "billedUnits": 1,
  "processedAt": "2026-10-20T08:15:02.512Z",
  "errorMessage": null
}
```

Failed images are listed too (free), so you can fix your catalog:

```json
{
  "sourceUrl": "https://example.com/images/missing.jpg",
  "status": "error",
  "errorMessage": "HTTP 404 when downloading the image",
  "processedAt": "2026-10-20T08:15:03.020Z"
}
```

Export the dataset as JSON, CSV, Excel or XML from the run page or the API.

### Use cases

#### 1. Shopify / WooCommerce merchant: convert the product catalog to WebP every night

An e-commerce manager with 4,000 product photos (JPEG, 1.5 MB on average) wants to pass Core Web Vitals. A nightly schedule with `onlyNew` converts only the photos added that day (≈ 30 per day ⇒ about $0.06 per night; the first full run costs $8).

```json
{
  "imageUrls": ["https://cdn.example-shop.com/products/sku-1042-front.jpg", "https://cdn.example-shop.com/products/sku-1042-back.jpg"],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1600,
  "onlyNew": true,
  "storeName": "shop-webp-catalog"
}
```

```json
[{ "sourceUrl": "https://cdn.example-shop.com/products/sku-1042-front.jpg", "fileUrl": "https://api.apify.com/v2/key-value-stores/…/records/sku-1042-front-a81c03f2e4.webp", "originalBytes": 1583201, "outputBytes": 148920, "savedPercent": 90.6 }]
```

Next: a Make scenario reads the dataset and updates the product image URLs (or uploads the files to the CDN). Page weight drops by ~85%.

#### 2. Web agency: AVIF hero images and square thumbnails for a site redesign

A front-end developer receives 250 images from the client's old site. One run makes 1:1 thumbnails for the listing grid, another makes AVIF hero images.

```json
{
  "imageUrls": ["https://old-site.example.com/uploads/team-photo.png", "https://old-site.example.com/uploads/office.jpg"],
  "outputFormat": "avif",
  "quality": 60,
  "maxWidth": 400,
  "maxHeight": 400,
  "fit": "cover"
}
```

```json
[{ "fileKey": "office-07be4c1d9a.avif", "width": 400, "height": 400, "originalBytes": 2380114, "outputBytes": 18342, "savedPercent": 99.2 }]
```

Cost: 500 images ⇒ about $1. The developer downloads the files with the API and commits them to the repo.

#### 3. Marketplace / feed manager: normalize supplier images before import

A feed manager imports 10,000 supplier images in mixed formats (PNG with transparency, HEIC, TIFF). Marketplaces want JPEG on a white background, max 2000 px, no metadata.

```json
{
  "imageUrls": ["https://supplier.example.com/media/ART-5531.png", "https://supplier.example.com/media/ART-5532.heic"],
  "outputFormat": "jpeg",
  "quality": 85,
  "maxWidth": 2000,
  "maxHeight": 2000,
  "backgroundColor": "#ffffff"
}
```

```json
[{ "sourceUrl": "https://supplier.example.com/media/ART-5531.png", "format": "jpeg", "hasAlpha": false, "width": 2000, "height": 2000, "savedPercent": 71.4 }]
```

Next: the CSV export (sourceUrl → fileUrl) is merged into the product feed in Google Sheets; rows with `status: "error"` go back to the supplier. Cost: about $20 for 10,000 images.

### API examples

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("<USERNAME>/bulk-image-optimizer").call(run_input={
    "imageUrls": ["https://picsum.photos/id/433/2400/1600.jpg"],
    "outputFormat": "webp",
    "quality": 80,
    "maxWidth": 1200,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["status"], item.get("fileUrl"), item.get("savedPercent"))
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('<USERNAME>/bulk-image-optimizer').call({
    imageUrls: ['https://picsum.photos/id/433/2400/1600.jpg'],
    outputFormat: 'avif',
    quality: 60,
    maxWidth: 1200,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((i) => [i.fileUrl, i.savedPercent]));
```

### Integrations (Make, Zapier, n8n, Google Sheets)

- **n8n / Make:** "Run Actor" module with the input above → "Get dataset items" → for each item, HTTP download `fileUrl` and upload it to S3, Cloudinary, Shopify or WordPress.
- **Zapier:** new row in a Google Sheet (column = image URL) → run the Actor → write `fileUrl` and `savedPercent` back to the row.
- **Google Sheets:** export the dataset as CSV, or use the Apify Google Sheets integration to push results automatically after each run.
- **Schedules:** Apify Schedules + `onlyNew: true` = a hands-off nightly image pipeline.
- **Webhooks:** get notified when the run finishes and pull the dataset.

### Use with AI agents (MCP)

This Actor works as a tool through the Apify MCP server (`https://mcp.apify.com`) in Claude, Cursor, ChatGPT, VS Code and any MCP client. Ask for example: *"Convert these 20 product photos to WebP, max 1200 px wide, and give me the download links and the total size saved."* The agent passes `imageUrls`, `outputFormat`, `quality` and `maxWidth`, then reads `fileUrl`, `savedPercent` and `errorMessage` from the dataset. Output is flat, typed JSON, easy for an LLM to summarize.

### FAQ

**Which format should I choose?** WebP for maximum compatibility (all current browsers) and a good size reduction. AVIF for the smallest files (often 20–40% smaller than WebP), at the cost of slower encoding. JPEG for marketplaces and email. PNG for logos and screenshots that must stay pixel-perfect.

**Will my images be upscaled?** No. With the default `inside` mode, images smaller than max width/height keep their size. Only `cover` and `contain` produce an exact size.

**Can the output be bigger than the input?** Yes, occasionally (e.g. an already-optimized JPEG converted to lossless PNG). `savedPercent` is then negative so you can spot it.

**How long are the files kept?** Files in the run's default store follow your Apify data retention. Set `storeName` to keep them in a named store indefinitely.

**Do you need my login or API keys for my CDN?** No. The Actor only downloads public URLs and never logs in anywhere.

**Is the source site affected?** Each image is downloaded once with polite concurrency (4 by default) and automatic retries with backoff on 429/5xx.

**What about animated GIFs/WebPs?** Only the first frame is kept (`wasAnimated: true` tells you).

### Limits

- Images must be publicly reachable. Hosts that block cloud servers, require a login or sit behind an anti-bot challenge will fail (free, reported in `errorMessage`). Private/internal network addresses are refused.
- Max 50 MB per source file (25 MB by default) and 100 megapixels per image.
- Memory: the default 512 MB run handles typical photos (up to about 30 MP decoded; JPEGs resized with `maxWidth`/`maxHeight` are decoded at reduced size, so 24 MP camera JPEGs work too). A larger PNG/WebP/TIFF, or a big JPEG kept at full size, is reported with a clear `errorMessage` (free) asking you to re-run with 1024 MB or more in Run options → Memory. The rest of the batch is always processed.
- Animated images are converted to a still image (first frame).
- SVG and RAW camera formats (CR2, NEF...) are not supported as input.
- AVIF encoding is CPU-heavy: expect roughly 2–4× longer runs than WebP for the same images.

# Actor input Schema

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

Public URLs of the images to optimize (JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP, HEIC). One URL per line. Duplicates are processed once; broken URLs are reported in the dataset and never billed.

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

Format of the optimized files. WebP is supported by all modern browsers and is usually 25-35% lighter than JPEG; AVIF is even lighter but slower to encode. "original" keeps the source format (JPEG, PNG, WebP or AVIF) and only compresses/resizes.

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

Compression quality for WebP, AVIF and JPEG. 75-85 is visually lossless for product photos. Ignored for PNG.

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

Resize images wider than this (aspect ratio kept, never upscaled). Leave empty to keep the original width.

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

Resize images taller than this (aspect ratio kept, never upscaled). Leave empty to keep the original height.

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

"inside": fit within max width/height, keep proportions, never upscale. "cover": crop to exactly max width × max height (centered, e.g. square thumbnails). "contain": letterbox to exactly max width × max height with the background color. cover/contain need both max width and max height.

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

Encode WebP/AVIF without any quality loss (bigger files). Useful for logos, icons and screenshots.

## `pngColors` (type: `integer`):

For PNG output only: reduce to a palette of this many colors (like pngquant) for 50-80% smaller PNGs. Leave empty for lossless PNG.

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

Hex color used to fill transparent areas when converting to JPEG and for the padding of "contain" mode.

## `keepMetadata` (type: `boolean`):

Keep EXIF data (camera, date, GPS...). Off by default: stripping it makes files smaller and protects privacy. Color profiles (ICC) are always kept and orientation is always applied.

## `onlyNew` (type: `boolean`):

Skip URLs already optimized with the same settings in a previous run (remembered in the named key-value store "bulk-image-optimizer-state"). Ideal for a daily schedule on a growing catalog: you only pay for new images.

## `storeName` (type: `string`):

Optional named key-value store where the files are saved (named stores are kept indefinitely). Empty = the run's default store.

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

Number of images downloaded in parallel. Lower it if the image server rate-limits you.

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

Source images heavier than this are skipped (reported, not billed).

## Actor input object example

```json
{
  "imageUrls": [
    "https://picsum.photos/id/433/2400/1600.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1200,
  "fit": "inside",
  "lossless": false,
  "backgroundColor": "#ffffff",
  "keepMetadata": false,
  "onlyNew": false,
  "maxConcurrency": 4,
  "maxInputSizeMb": 25
}
```

# Actor output Schema

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

One row per image: download link, sizes before/after, saved %, dimensions, errors.

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

The optimized image files (when no custom store name is set).

# 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://picsum.photos/id/433/2400/1600.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    ],
    "outputFormat": "webp",
    "quality": 80,
    "maxWidth": 1200,
    "backgroundColor": "#ffffff"
};

// Run the Actor and wait for it to finish
const run = await client.actor("actose/bulk-image-optimizer").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://picsum.photos/id/433/2400/1600.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    ],
    "outputFormat": "webp",
    "quality": 80,
    "maxWidth": 1200,
    "backgroundColor": "#ffffff",
}

# Run the Actor and wait for it to finish
run = client.actor("actose/bulk-image-optimizer").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://picsum.photos/id/433/2400/1600.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1200,
  "backgroundColor": "#ffffff"
}' |
apify call actose/bulk-image-optimizer --silent --output-dataset

```

## MCP server setup

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

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/xLORorbffuwyjgwf8/builds/9dcwKfJLAFYWdVtEo/openapi.json
