# Bulk Image Compressor & Converter — WebP, AVIF, JPEG, PNG (`openregistry/image-compressor-converter`) Actor

Compress and convert images in bulk from URLs: WebP, AVIF, JPEG (mozjpeg) or PNG, resize to max width/height, set quality, strip EXIF, fix rotation. Each image gets a public download link and the bytes saved. Pay per image.

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

## Pricing

$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 Compressor & Converter — WebP, AVIF, JPEG, PNG

Paste a list of image URLs and get back **lighter, web-ready images** with a public download link for each, plus the exact bytes saved. Convert to **WebP**, **AVIF**, **JPEG** (mozjpeg) or **PNG**, resize to a maximum width/height, choose the quality, strip EXIF/GPS data. Powered by libvips (sharp), the fastest image library for Node.js.

### Features

- **Formats**: WebP, AVIF, JPEG (progressive, mozjpeg), PNG (palette quantization or lossless), or keep the source format and only compress.
- **Input**: JPEG, PNG, WebP, AVIF, GIF (animated GIF → animated WebP), TIFF, SVG.
- **Resize**: max width and/or height; inside (keep ratio), cover (crop), contain (pad with a background color) or fill; no upscaling unless you allow it.
- **Clean output**: EXIF orientation applied (no sideways phone photos), metadata and GPS location removed by default, transparency flattened on a color of your choice for JPEG.
- **Report**: source and output format, dimensions, size in bytes and % saved for every image.
- **Custom file names** with `{ "url": "...", "name": "hero-banner" }`.

### What it is for

- **Core Web Vitals / PageSpeed**: convert a site's or a store's images to WebP or AVIF and cut page weight by 50-90%.
- **E-commerce catalogs**: normalize supplier product photos to one size and format before importing them into Shopify, WooCommerce or a PIM.
- **Scraping pipelines**: shrink images collected by another Actor before storing them.
- **Privacy**: remove GPS coordinates and camera data from photos before publishing.
- **No-code automation**: call it from Make, Zapier or n8n and get the new image links back.

### Input example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
    { "url": "https://example.com/images/banner.jpg", "name": "hero-banner" }
  ],
  "format": "webp",
  "quality": 80,
  "maxWidth": 1200
}
```

- `imageUrls` — links, or objects with `url` and `name`.
- `format` — `webp` (default), `avif`, `jpeg`, `png` or `original`.
- `quality`, `lossless`, `maxWidth`, `maxHeight`, `fit`, `allowUpscale`, `keepMetadata`, `background` — conversion options.
- `maxFileSizeMb`, `maxResults` — limits; `maxResults` caps the cost.

### Output example

One dataset row per image; the files are in the run's key-value store.

```json
{
  "index": 1,
  "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
  "name": null,
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/img-00001-PNG_transparency_demonstration_1.webp?signature=<signature>",
  "key": "img-00001-PNG_transparency_demonstration_1.webp",
  "format": "webp",
  "originalFormat": "png",
  "originalWidth": 800,
  "originalHeight": 600,
  "width": 400,
  "height": 300,
  "originalBytes": 224566,
  "outputBytes": 28518,
  "savedPercent": 87.3,
  "error": null
}
```

(Real result for that image with `maxWidth: 400`.)

### Good to know

- An image that cannot be downloaded (broken link, login required, blocked), a link that returns a web page instead of an image, or a file that is not an image returns a row with an `error` message and is **not charged**.
- Downloads use plain HTTP requests with the Actor's own User-Agent (`OpenRegistry-ImageCompressor`) and respect `robots.txt`; no browser imitation, no proxies. Process images you own or are allowed to reuse.
- Links are signed, so they open without an Apify token even when your storages are private. They stay valid as long as the run's storage is kept (7 days on the free plan for unnamed storages); download the files if you need them longer.
- AVIF gives the smallest files but encodes more slowly; give the run more memory for large batches of big photos.

### Pricing

**$0.001 per image** ($1 per 1,000 images). Failed images are free. Set a maximum charge per run in the Apify console and the Actor stops cleanly when it is reached.

# Actor input Schema

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

Array of links (strings), or objects { "url": "...", "name": "hero-banner" } to choose the output file name. JPEG, PNG, WebP, AVIF, GIF, TIFF and SVG are accepted.

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

Animated GIFs stay animated when converted to WebP.

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

75-85 is visually lossless for most photos. For PNG, below 100 enables palette quantization.

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

Optional. 0 or empty = keep the original width.

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

Optional. 0 or empty = keep the original height.

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

Used when max width and/or height are set.

## `allowUpscale` (type: `boolean`):

Off: images smaller than the box keep their size.

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

Exact pixels, larger files.

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

Off by default: removes camera data and GPS location, which also saves bytes. Rotation from EXIF is always applied.

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

Hex. Fills transparency when converting to JPEG and the padding in Contain mode.

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

Larger files are skipped (not charged).

## `maxResults` (type: `integer`):

The run stops once this many images are converted, so you control the cost.

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "format": "webp",
  "quality": 80,
  "fit": "inside",
  "allowUpscale": false,
  "lossless": false,
  "keepMetadata": false,
  "background": "#ffffff",
  "maxFileSizeMb": 25,
  "maxResults": 10000
}
```

# Actor output Schema

## `results` (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": [
        "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("openregistry/image-compressor-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/4/47/PNG_transparency_demonstration_1.png"] }

# Run the Actor and wait for it to finish
run = client.actor("openregistry/image-compressor-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/4/47/PNG_transparency_demonstration_1.png"
  ]
}' |
apify call openregistry/image-compressor-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,openregistry/image-compressor-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/gbbUDU6EkFsakmPX1/builds/0x8D9GBFTZoqy41rO/openapi.json
