# Bulk Image Converter & Compressor – WebP, AVIF, PNG (`innovative_cookie/image-converter`) Actor

Convert and compress images in bulk to WebP, AVIF, JPEG or PNG. Resize, strip metadata, compare sizes before/after. Input URLs, uploads or a dataset.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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

### What does Bulk Image Converter & Compressor do?

**Bulk Image Converter & Compressor** converts and compresses images in bulk to **WebP, AVIF, JPEG or PNG** (plus GIF and TIFF), resizes them, and strips EXIF/GPS metadata. Give it a list of image URLs, upload files, or point it at the dataset of another Actor (for example a product or real-estate scraper). You get the optimized files in the key-value store, with a direct download link for each one, and a report showing the **file size before and after**.

It runs on plain HTTP and [libvips](https://www.libvips.org/) (through sharp), with no browser, so it is fast and cheap. A 5 MB photo becomes a 270 KB WebP in well under a second.

### Why use this image optimizer?

- **Faster websites and better Core Web Vitals.** WebP and AVIF are 30–90 % smaller than JPEG/PNG. Smaller images improve LCP and the Google PageSpeed score.
- **Bulk e-commerce catalogues.** Turn thousands of supplier photos into uniform 1200 px WebP files for Shopify, WooCommerce or a marketplace feed.
- **Thumbnails.** Make square 400×400 crops (`fit: cover`) for listings, cards and social previews.
- **Chain it after a scraper.** Pass a `datasetId` and the field that holds the image URL (`imageUrl`, `images`, `images.url`, …). Arrays are expanded automatically.
- **Privacy.** EXIF metadata, including the GPS location of phone photos, is removed by default.
- **Format compatibility.** Convert SVG, GIF, TIFF, AVIF or WebP to JPEG/PNG for tools that do not support modern formats.
- **Automation.** Run it via the Apify API, on a schedule, or from Make, Zapier or n8n.

#### What makes it different

| Feature | This Actor |
|---|---|
| Output formats | WebP, AVIF, JPEG, PNG, GIF, TIFF, or keep the original |
| Inputs | URLs, uploaded files, or any Apify dataset (nested fields and arrays) |
| Animated GIF → animated WebP | ✅ keeps every frame |
| Transparency | ✅ kept for WebP/AVIF/PNG; flattened to the colour you choose for JPEG |
| Never makes a file bigger | ✅ keeps the original when recompression would increase the size |
| Report | size before/after, % saved, dimensions, processing time, errors |
| Failed images | listed with the reason and **reported** |

### How to convert images in bulk

1. Click **Try for free**.
2. Paste image URLs, upload files, or enter the ID of a dataset with image URLs.
3. Choose the **output format** (WebP is the best default; AVIF is smallest) and the **quality** (75–85 is visually lossless for photos).
4. Optionally set a **max width/height** and the **fit** mode.
5. Click **Start**. Download the files from the `outputUrl` links in the **Output** tab, or the whole key-value store via the API.

### Input example

```json
{
    "imageUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    ],
    "format": "webp",
    "quality": 80,
    "width": 1200,
    "fit": "inside",
    "withoutEnlargement": true
}
```

Using the output of another Actor:

```json
{
    "datasetId": "YOUR_DATASET_ID",
    "datasetUrlField": "images",
    "format": "avif",
    "quality": 55,
    "width": 400,
    "height": 400,
    "fit": "cover",
    "keyPrefix": "thumb-"
}
```

### Output example

Every image produces one dataset row. You can download the report as JSON, CSV, Excel or HTML.

```json
{
    "sourceUrl": "https://upload.wikimedia.org/wikipedia/commons/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg",
    "status": "ok",
    "error": null,
    "inputFormat": "jpeg",
    "inputBytes": 5279797,
    "inputWidth": 2900,
    "inputHeight": 5367,
    "outputFormat": "webp",
    "outputBytes": 267352,
    "outputWidth": 1200,
    "outputHeight": 2221,
    "savedBytes": 5012445,
    "savedPercent": 94.9,
    "keptOriginal": false,
    "key": "img-Tour_Eiffel_Wikimedia_Commons-9776994a.webp",
    "outputUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/img-Tour_Eiffel_Wikimedia_Commons-9776994a.webp",
    "processingMs": 705
}
```

The `SUMMARY` record in the key-value store holds the totals (images converted, failed, total MB before/after, % saved).

### How much does it cost to convert images?

The Actor itself is **free to use**: there is no Actor fee for now. You only pay the Apify platform usage of your runs (compute units and data transfer), which stays small because the Actor uses plain HTTP requests, without a browser or proxy. The Apify Free plan includes $5 of monthly credit, which covers a lot of test runs.

Large images and AVIF output take the most compute; resizing first keeps runs cheaper.

### Tips

- **WebP** works in every modern browser. **AVIF** is 20–50 % smaller still, but encoding is slower. Use `effort` to balance speed and size.
- Use `lossless: true` for logos, screenshots and UI graphics.
- For JPEG output, transparent areas are filled with `background` (default white).
- Increase memory and `maxConcurrency` for very large batches.
- Files larger than `maxInputMB` (25 MB by default) are skipped.

### FAQ

**Which input formats are supported?**
JPEG, PNG, WebP, AVIF, GIF (including animated), TIFF and SVG. HEIC/HEIF photos from iPhones are not supported yet.

**Will my images get bigger?**
No. If you keep the same format without resizing and recompression would make the file larger, the original file is kept (`keptOriginal: true`).

**Does it keep animations?**
Yes, animated GIF and WebP stay animated when the output is WebP or GIF. Set `animated: false` to keep only the first frame.

**How long are files kept?**
Files stay in the run's key-value store for your plan's data retention period. Copy them to your own storage (S3, Google Drive, …) via the API or an integration if you need them longer.

**Can I process images that need a login?**
No. The Actor downloads only the public URLs you supply, with a clear user-agent (`ImageConverterBot/1.0`). Private or local network addresses are blocked.

**Is there an API?**
Yes. Start runs and download results through the [Apify API](https://docs.apify.com/api/v2) or the JavaScript and Python clients.

**I found a bug or need a feature.**
Open an issue in the **Issues** tab. Issues are usually answered quickly.

### Is it legal to convert images from the web?

This Actor only transforms the files you point it at. Make sure you own the images or have the right to modify and reuse them; copyright and licence terms still apply to the converted files. Images can contain personal data (faces, EXIF location); this Actor removes metadata by default, but you remain responsible for complying with GDPR and other regulations. If unsure, consult a lawyer.

### Related actors

More Actors by the same author ([innovative_cookie on Apify](https://apify.com/innovative_cookie)):

- [Sitemap URL Extractor](https://apify.com/innovative_cookie/sitemap-extractor): list every URL of a website from its XML sitemaps.
- [PageSpeed Insights Bulk Checker](https://apify.com/innovative_cookie/pagespeed-bulk): Core Web Vitals and Lighthouse scores for many URLs.
- [Bulk Domain Availability Checker](https://apify.com/innovative_cookie/domain-availability): check whether domain names are free via RDAP.
- [Logo & Favicon Extractor](https://apify.com/innovative_cookie/logo-favicon): get the logo and favicon of any website.
- [Website Image Extractor](https://apify.com/innovative_cookie/website-image-extractor): list every image of a page with size, format and alt text.

# Actor input Schema

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

Public URLs of the images to convert (JPEG, PNG, WebP, AVIF, GIF, TIFF, SVG). One per line.

## `files` (type: `array`):

Upload images from your computer (stored in your Apify key-value store).

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

Optional: ID of a dataset produced by another Actor (e.g. a product scraper). Image URLs are read from the field below.

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

Field name in the dataset items that holds the image URL (dot notation allowed, arrays are expanded). Example: imageUrl or images.

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

Target format. 'original' keeps the input format and only resizes or recompresses.

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

Lower = smaller files. 75-85 is visually lossless for most photos.

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

Pixel-perfect output. Larger files; best for logos, screenshots and UI graphics.

## `keepOriginalIfSmaller` (type: `boolean`):

When the output format equals the input format and no resize is requested, keep the original file if recompression would make it larger.

## `width` (type: `integer`):

Resize to this width. Leave empty to keep the original size.

## `height` (type: `integer`):

Resize to this height. Leave empty to keep the original size.

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

How to fit the image into width x height. 'inside' keeps the aspect ratio (thumbnails), 'cover' crops to fill, 'contain' letterboxes, 'fill' stretches.

## `withoutEnlargement` (type: `boolean`):

Do not upscale images that are already smaller than the target size.

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

Used when flattening transparency to JPEG and for 'contain' letterboxing. Hex colour.

## `autoOrient` (type: `boolean`):

Rotate phone photos so they display upright.

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

By default all metadata, including GPS location, is removed. This protects privacy and makes files smaller.

## `animated` (type: `boolean`):

Convert animated GIF/WebP as animations when the output format supports it (WebP, GIF).

## `effort` (type: `integer`):

CPU effort: WebP 0-6, AVIF 0-9, PNG 1-10. Higher = smaller but slower. Leave empty for balanced defaults.

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

Optional prefix added after 'img-' in output file names (e.g. 'shop-' gives img-shop-photo-1a2b3c4d.webp).

## `maxInputMB` (type: `integer`):

Larger files are skipped (and not charged).

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

Increase with more memory. 4 is good for 1 GB.

## `requestTimeoutSecs` (type: `integer`):

Timeout for downloading each image (retried twice on network errors, 429 and 5xx).

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
  ],
  "datasetUrlField": "imageUrl",
  "format": "webp",
  "quality": 80,
  "lossless": false,
  "keepOriginalIfSmaller": true,
  "fit": "inside",
  "withoutEnlargement": true,
  "background": "#ffffff",
  "autoOrient": true,
  "keepMetadata": false,
  "animated": true,
  "keyPrefix": "",
  "maxInputMB": 25,
  "maxConcurrency": 4,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per image with sizes before/after and the download URL

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

Key-value store with the optimized images

# 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("innovative_cookie/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/4/47/PNG_transparency_demonstration_1.png"] }

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

```

## MCP server setup

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