# Image Converter, Compressor & Resizer (WebP, AVIF, JPEG, PNG) (`dojito/image-converter-compressor`) Actor

Convert and compress images in bulk to WebP, AVIF, JPEG or PNG. Set quality and max width/height (aspect kept), strip EXIF/GPS. Paste image URLs; get files with a direct link and % saved. $0.002 per image (per 4 MP in or 2 MB out); failed images free.

- **URL**: https://apify.com/dojito/image-converter-compressor.md
- **Developed by:** [Dongjin Kim](https://apify.com/dojito) (community)
- **Categories:** Developer tools, 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.50 / 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.
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 & Resizer (WebP, AVIF, JPEG, PNG)

Convert and compress images in bulk. Paste image URLs, pick an output format (**WebP, AVIF, JPEG or PNG**, or keep the original format), a quality, and optionally a maximum width / height. Each image is converted, shrunk to fit (aspect ratio kept, never enlarged), stripped of EXIF / GPS metadata by default, and saved in the run's storage with a direct download link. The dataset row shows the old and new format, file size and pixel size, and **how many % smaller** the new file is.

Typical uses: make a folder of product or blog photos web-ready (WebP or AVIF, max 1600 px wide), shrink phone photos before uploading them, convert PNG screenshots to WebP, or remove camera and location data from pictures before you publish them.

- Input formats: JPEG, PNG, WebP, AVIF, GIF, BMP, TIFF (up to 50 MB per file)
- Output formats: WebP, AVIF, JPEG, PNG, or `keep` (same format, recompressed; GIF, BMP and TIFF become PNG)
- Transparency is kept in WebP, AVIF and PNG (JPEG has none: transparent areas become white)
- Failed, refused and broken images are **free**

### How to use

1. Paste direct image URLs into **Image URLs** (Bulk edit: one URL per line).
2. Choose **Output format** and **Quality** (default WebP, 80).
3. Optionally set **Max width** and / or **Max height** in pixels.
4. Click **Start**. Download the files from the links in the dataset (column `kvUrl`), or turn on **ZIP link** to get them all in one ZIP.

#### Input example

```json
{
  "imageUrls": [
    { "url": "https://upload.wikimedia.org/wikipedia/commons/9/92/Boucherie_in_S%C3%A3o_Paulo_City.jpg" },
    { "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png" }
  ],
  "format": "webp",
  "quality": 80,
  "maxWidth": 1600,
  "stripMetadata": true,
  "zip": true
}
```

| Field | Default | What it does |
|---|---|---|
| `imageUrls` | — | Direct image links (up to 5,000 per run). Duplicates are processed once. |
| `format` | `webp` | `webp`, `avif`, `jpeg`, `png` or `keep`. |
| `quality` | 80 | 1–100 for WebP, AVIF and JPEG. Lower = smaller files. Not used for PNG (lossless). |
| `maxWidth` / `maxHeight` | 0 (no limit) | Shrink to fit inside these sizes, aspect ratio kept. Never enlarges. |
| `stripMetadata` | true | Remove EXIF (camera, date, GPS). The colour profile is kept. |
| `maxItems` | 100 | Process at most this many URLs. |
| `zip` | false | Also give one link to a ZIP of all converted images (no extra charge). |

### What you get

One dataset row per URL. Real output from a cloud test run (WebP, quality 80, maxWidth 1600):

| url (file) | status | inputFormat | inputBytes | input px | format | bytes | output px | savedPercent | chargedEvents |
|---|---|---|---|---|---|---|---|---|---|
| 250px-Swallow…grey_wall.jpg | ok | jpeg | 19,609 | 250×250 | webp | 13,812 | 250×250 | 29.6 | 1 |
| PNG_transparency_demonstration_1.png | ok | png | 224,566 | 800×600 | webp | 69,056 | 800×600 | 69.2 | 1 |
| Dyson_ring_2.webp | ok | webp | 100,496 | 1920×1080 | webp | 15,316 | 1600×900 | 84.8 | 1 |
| Boucherie_in_São_Paulo_City.jpg | ok | jpeg | 7,652,819 | 3000×2292 | webp | 439,202 | 1600×1222 | 94.3 | 2 |
| truncated_jpeg.jpg (broken file) | not_an_image | jpeg | 6,698 | 100×100 | | | | | 0 |

Columns: `url`, `status`, `inputFormat`, `inputBytes`, `inputWidth`, `inputHeight`, `format`, `bytes`, `width`, `height`, `savedPercent` (negative if the new file is larger), `kvKey`, `kvUrl`, `chargedEvents`, `error`, `note`.

- **Files**: each converted image is a record in the run's key-value store, key `converted-<name from the URL>.<webp|avif|jpg|png>`. `kvUrl` is a direct link; anyone who has that link can open the file, so do not share it if the image is private.
- **RUN_REPORT** record: images saved, events charged, total bytes in and out and % saved, failed URLs by reason, the ZIP link (like `kvUrl`, anyone who has it can download the files), and your settings.
- **Status values**: `ok`, `not_an_image` (web page, PDF, HEIC, broken or cut-off file), `unsupported_format`, `too_large`, `output_too_large`, `conversion_failed`, `http_error`, `robots_txt`, `blocked_site`, `terms_of_use`, `private_page`, `invalid_url`, `download_failed`, `storage_error`, `internal_error`. Only `ok` rows are charged.
- **How long files stay**: the files and links live in the run's storage, which Apify deletes after your plan's data retention period. Download the files you need soon after the run.

### Pricing

Pay per event — you pay only for images that were converted and saved:

| Event | Free plan | Bronze | Silver and up |
|---|---|---|---|
| `image-converted`, per started 4 MP of the input image or per started 2 MB of the new file, whichever is more | $0.002 | $0.0018 | $0.0015 |

A 1920×1080 image (2.1 MP) saved as WebP, AVIF or JPEG = 1 event. A 12 MP phone photo = 3 events ($0.006 on the free plan). 1,000 web images up to 4 MP = $2.00. The file-size rule matters mainly for lossless PNG output of photos (about 2 bytes per pixel): a 10.6 MP photo saved as a 12.9 MB PNG = 7 events. Storing large files costs platform transfer, which is why it is counted. The row's `chargedEvents` shows the count for each image. Failed, refused, broken, robots.txt-blocked and over-limit URLs cost nothing. Apify's standard actor-start event applies once per run. You can cap a run with **Maximum cost per run**: you are never charged more than it, and no image is started whose pixel count would go over it (if a new file turns out larger than expected, its extra events are simply not charged).

### Limits (please read)

- **Direct image URLs only.** The actor does not search web pages for images, log in, use cookies or proxies, or get past bot protection or CAPTCHAs. A URL that returns a web page is refused (free).
- **Not fetched** (by our policy, free rows): private and local network addresses, video / social / stock-photo platforms and their image hosts, Google, large retailers and marketplaces, login and account pages. robots.txt is respected; one request at a time per website with a pause, so many images from one site take about 1 second each.
- **Size**: 50 MB per file, 30,000 px per side. Input up to 19 MP (width × height) at the default 1 GB memory, 44 MP at 2 GB and 50 MP at 4 GB (set the run memory in the run options). Larger images are refused, not charged. WebP output is limited to 16,383 px per side (set maxWidth / maxHeight to fit).
- **Animated GIF / WebP and multi-page TIFF**: only the first frame is converted (the row says so).
- **Not supported as input**: HEIC / HEIF (iPhone default), SVG, PDF, RAW camera files, ICO.
- **Quality scales differ** between formats: AVIF at quality 80 is often larger than WebP at 80. Try 50–65 for AVIF. AVIF is encoded at a fast speed setting (libavif speed 9), which gives files about 10 % larger than the slowest setting.
- **Metadata**: with `stripMetadata` on, EXIF (camera, date, GPS), XMP, IPTC and comments are removed; the EXIF rotation is applied to the pixels first, so photos stay upright. The ICC colour profile is kept so colours do not change. With it off, only the EXIF block is copied — XMP, IPTC and PNG text notes are never copied, and these are where many copyright notices are kept, so this actor cannot keep them. EXIF author and copyright fields survive only with `stripMetadata` off. Do not use this actor to remove someone else's copyright information.
- **CMYK images** are converted to RGB (using their embedded colour profile when they have one). 16-bit images become 8-bit.
- Re-encoding a file that is already well compressed can make it **larger** — `savedPercent` is then negative and the row has a note.

### Responsible use

Only convert images you have the right to use. Converting or compressing an image does not give you any rights to it. Images are downloaded to a temporary file, converted, and deleted; only the result is stored, in **your** run's storage. We do not keep, view or reuse your images. If your images show people, you are responsible for having a lawful basis to process them (e.g. GDPR, PIPEDA).

### FAQ

**Why was my image refused as `not_an_image`?** The URL returned a web page, a PDF, a HEIC file, or a broken / cut-off image. Open the URL in a browser: it must show only the image. The `error` column says what was received.

**Can I upload files from my computer?** Not directly. Put the files somewhere with a public URL first (for example an Apify key-value store, S3 or your own website).

**Will the colours change?** No — the colour profile is kept. Exceptions: CMYK images are converted to RGB, and a grayscale image with a grayscale colour profile loses that profile when saved as WebP or AVIF (these store colour images only).

**Is AVIF or WebP better?** Both are much smaller than JPEG for photos. WebP is supported by every current browser and encodes faster; AVIF is usually smaller at the same visual quality and is supported by current Chrome, Firefox, Safari and Edge.

**Does it upscale?** No, images are only shrunk, never enlarged.

### Speed and resources, measured

Cloud test runs on Apify, build 1.0.3, November 2026 (platform cost is paid by us, the developer, under pay per event):

| Run | Memory | Run time | Events | Platform cost per event |
|---|---|---|---|---|
| The 5 images in the table above → WebP, max width 1600 | 1 GB | 7 s | 5 | $0.00016 |
| 2 photos (10.6 MP, 6.9 MP) + transparent PNG → AVIF, full size | 1 GB | 5 s | 6 | $0.00011 |
| 2 photos → PNG, full size (25.7 MB written) | 1 GB | 9 s | 14 | $0.00014 |
| 20 MP photo → AVIF, full size | 2 GB | 5 s (peak memory 595 MB) | 5 | $0.00016 |

Most of the time per image is the download (one request per second per website). Conversion itself takes well under a second for a typical web image.

### Credits

Made by DOJITO. Converts with [Pillow](https://python-pillow.github.io/) (MIT-CMU licence), which includes libavif, libwebp, libjpeg-turbo and zlib. Example images from Wikimedia Commons: "Boucherie in São Paulo City" (CC0), "Swallow Prominent on a grey wall" (CC0), "Dyson ring 2" (CC0), "PNG transparency demonstration 1" by Daniel G., Ed g2s and CyberShadow from POV-Ray source code ([CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/), used only as a test input; only its sizes are quoted); broken test file `truncated_jpeg.jpg` from Pillow's test suite. Not affiliated with Apify, Google, the Alliance for Open Media or the Pillow project.

# Actor input Schema

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

Direct links to images: JPEG, PNG, WebP, AVIF, GIF, BMP or TIFF (up to 5,000 per run, 50 MB per file). Web pages, share pages, HEIC, SVG and other files are refused and not charged. Duplicate URLs are processed once. Paste the URLs (Bulk edit: one per line); linked or uploaded URL lists are not supported.

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

webp = small files every browser shows, keeps transparency. avif = usually the smallest at the same look, keeps transparency (newer browsers). jpeg = works everywhere, transparent areas become white. png = lossless and large (quality is not used). keep = same format as the input, recompressed (GIF, BMP and TIFF become PNG).

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

For webp, avif and jpeg: lower = smaller files and more visible artifacts. 75-85 is a common choice for the web. The scales of the three formats are not identical (avif at 80 is often larger than webp at 80). Not used for png.

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

Shrink images wider than this, keeping the aspect ratio. 0 = no limit. Images are never enlarged.

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

Shrink images taller than this, keeping the aspect ratio (with Max width too: the image fits inside both). 0 = no limit. Never enlarged.

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

On: camera, date and GPS data (EXIF), XMP, IPTC and comments are removed (the colour profile is kept so colours do not change). The EXIF rotation is always applied to the pixels. Off: only the EXIF block is copied to the new file; XMP, IPTC and PNG text (where many copyright notices are kept) are never copied.

## `maxItems` (type: `integer`):

Process at most this many URLs (the first ones in the list). Also cap your spend with the run's maximum cost: no image is started that would go over it.

## `zip` (type: `boolean`):

Also give one link that downloads every converted image of this run as a single ZIP (Apify builds it when you open the link; no extra charge). The link is in the RUN_REPORT record and the run's status message.

## Actor input object example

```json
{
  "imageUrls": [
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/9/92/Boucherie_in_S%C3%A3o_Paulo_City.jpg"
    }
  ],
  "format": "webp",
  "quality": 80,
  "maxWidth": 0,
  "maxHeight": 0,
  "stripMetadata": true,
  "maxItems": 100,
  "zip": false
}
```

# Actor output Schema

## `overview` (type: `string`):

One row per URL: status, old and new format, bytes and pixel size, % saved, image link. Failed URLs have an error status and are not charged.

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

The key-value store with every converted image (keys starting with converted-).

## `runReport` (type: `string`):

JSON: images saved, events charged, bytes saved, failed URLs by reason, ZIP link. Free.

# 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": [
        {
            "url": "https://upload.wikimedia.org/wikipedia/commons/9/92/Boucherie_in_S%C3%A3o_Paulo_City.jpg"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dojito/image-converter-compressor").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": [{ "url": "https://upload.wikimedia.org/wikipedia/commons/9/92/Boucherie_in_S%C3%A3o_Paulo_City.jpg" }] }

# Run the Actor and wait for it to finish
run = client.actor("dojito/image-converter-compressor").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": [
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/9/92/Boucherie_in_S%C3%A3o_Paulo_City.jpg"
    }
  ]
}' |
apify call dojito/image-converter-compressor --silent --output-dataset

```

## MCP server setup

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

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/lenj9hAhDssqChSqe/builds/hKrgvHt7mh7BNxve7/openapi.json
