# Image Converter & Compressor for AI Agents (`ent-e/image-converter-compressor`) Actor

Convert to WebP, AVIF, JPEG, PNG, GIF or TIFF from image URLs. Compress to a target file size (maxBytes), resize, auto-rotate, strip EXIF/GPS by default. Returns a download URL, dimensions and % saved. MCP, n8n, Make, API. $1 per 1,000 images. Failed images free.

- **URL**: https://apify.com/ent-e/image-converter-compressor.md
- **Developed by:** [ENT-E](https://apify.com/ent-e) (community)
- **Categories:** AI, Agents, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.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

## Image Converter & Compressor for AI Agents

**Convert to WebP** or AVIF, compress to a target file size, resize, and strip EXIF/GPS metadata from any image URL, in one API call at $1 per 1,000 images. Nothing to install, no server to run.

### Convert to WebP, AVIF, JPEG, PNG, GIF or TIFF from a URL

You send a public image URL (or a batch of them) and choose a format. The Actor converts, resizes and compresses each image, stores the result in your run's key-value store, and returns one row per image with a download link (`outputUrl`), the final dimensions, the output size and the percentage saved.

- **Formats out:** `webp` (default), `avif`, `jpeg`, `png`, `gif`, `tiff`
- **Formats in:** JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP and more (for animated GIFs, only the first frame is used)
- **Compress to a target size:** set `maxBytes` and quality is lowered automatically until the image fits (JPEG, WebP, AVIF)
- **Resize:** cap the size with `maxWidth` and/or `maxHeight`
- **Privacy:** EXIF and GPS metadata are removed by default (`stripMetadata: true`)
- **Handled for you:** images are auto-rotated using their EXIF orientation, and transparency is flattened when you output JPEG
- **Failed images are free:** a bad URL or unreadable file comes back as a `status: "error"` row, and the run continues

### Why use it

- **Nothing to install.** No image libraries, no Docker, no server, no build step in your pipeline.
- **A specific result per call.** "This photo as WebP, under 150 KB, max 1200 px wide, GPS removed" is one JSON object.
- **Low, predictable cost.** $0.001 per converted image, the same whatever the format or size. Failed images cost nothing.
- **Fits your stack.** Call it from MCP clients like Claude and Cursor (through Apify's MCP server), n8n, Make, Zapier or the API.
- **Structured output.** Every row has `outputUrl`, `width`, `height`, `outputBytes` and `savedPercent`, so an agent or workflow can check the result and move on.

### Use cases

#### Convert to WebP (and AVIF converter)

Serve modern formats without a build pipeline. WebP is the default. Switch to `avif` for smaller files where browsers support it.

```json
{
  "url": "https://example.com/images/hero.png",
  "target": "webp",
  "quality": 80
}
```

```json
{
  "url": "https://example.com/images/hero.png",
  "target": "avif"
}
```

#### Compress image to target size

Upload forms, email templates, marketplaces and model APIs often cap file size. Set `maxBytes` (in bytes, for example 150,000 for about 150 KB) and the Actor lowers quality to fit.

```json
{
  "url": "https://example.com/uploads/product-photo.jpg",
  "target": "jpeg",
  "maxBytes": 150000
}
```

#### Remove EXIF / GPS metadata

Photos from phones can carry location and device data. Metadata is stripped by default, so a plain conversion already removes it. Set it explicitly to make the intent clear in your workflow.

```json
{
  "url": "https://example.com/uploads/customer-photo.jpg",
  "target": "jpeg",
  "stripMetadata": true
}
```

#### Resize image API

Generate a consistent max width for cards, thumbnails or model input.

```json
{
  "url": "https://example.com/images/banner.jpg",
  "target": "webp",
  "maxWidth": 800,
  "maxHeight": 800
}
```

#### Bulk image compressor

Process a whole catalog or media library in one run. Top-level settings (`target`, `quality`, `maxWidth`, `maxHeight`, `maxBytes`, `stripMetadata`) apply to every file, and each file can override any of them.

```json
{
  "target": "webp",
  "quality": 75,
  "maxWidth": 1600,
  "files": [
    { "url": "https://example.com/catalog/sku-001.jpg" },
    { "url": "https://example.com/catalog/sku-002.png" },
    { "url": "https://example.com/catalog/sku-003.jpg", "target": "avif", "maxWidth": 800 },
    { "url": "https://example.com/catalog/sku-004.jpg", "quality": 60, "maxBytes": 80000 }
  ]
}
```

#### Image optimization for websites

Make site images lighter for faster pages: resize to the largest size you display, convert to WebP and set a byte budget.

```json
{
  "url": "https://example.com/blog/cover.png",
  "target": "webp",
  "maxWidth": 1200,
  "maxBytes": 120000
}
```

#### n8n image compression (and Make / Zapier)

Drop it into a workflow after a form upload, a CMS trigger or a scraper. Map each result's `outputUrl` into your storage or CMS step.

```json
{
  "url": "{{ $json.imageUrl }}",
  "target": "webp",
  "maxBytes": 200000
}
```

### Pricing

Pay per event, only for images that convert successfully:

| Event | Price |
|---|---|
| Image converted (per successful image) | **$0.001** ($1 per 1,000 images) |
| Actor start (per run, one event per GB of memory, minimum one; default 512 MB = 1 event) | $0.00005 per event |

Failed images are free.

#### Worked cost examples

- **1,000 images:** 1,000 × $0.001 = **$1.00**
- **A 10,000-SKU product catalog to WebP:** 10,000 × $0.001 = **$10.00**
- **A 250-image blog migration to AVIF:** 250 × $0.001 = **$0.25**
- Add $0.00005 per run for the actor start at the default 512 MB memory.

The price is the same for every format, quality setting and image size. To cap spend on a run, set a maximum total charge in the run options.

### Input reference

| Field | Type | Default | Description |
|---|---|---|---|
| `url` | string | – | Public URL of one image (JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP...). |
| `files` | array | – | Batch of images, e.g. `[{"url": "...", "target": "avif", "maxWidth": 800}]`. Each item can override any setting below; top-level values are the defaults for every item. Plain URL strings also work. |
| `target` | string | `webp` | Output format: `webp`, `avif`, `jpeg`, `png`, `gif`, `tiff`. |
| `quality` | integer | `80` | Quality from 1 to 100 for JPEG, WebP and AVIF (ignored for PNG, GIF, TIFF). With `maxBytes`, this is the starting quality. |
| `maxWidth` | integer | – | Maximum width in pixels. Downscales proportionally, never upscales. |
| `maxHeight` | integer | – | Maximum height in pixels. Downscales proportionally, never upscales. |
| `maxBytes` | integer | – | Target maximum file size in bytes (minimum 1000). Quality is lowered automatically to fit. Applies to JPEG, WebP and AVIF. |
| `stripMetadata` | boolean | `true` | Remove EXIF/GPS metadata. |

Limits: up to 50 MB and 100 megapixels per image. Only process images you have the rights to.

### Output reference

One dataset row per input image. Converted files are stored in the run's default key-value store, and `outputUrl` points to the file.

```json
{
  "sourceUrl": "https://example.com/images/hero.png",
  "target": "webp",
  "status": "ok",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/<key>.webp",
  "mime": "image/webp",
  "width": 1200,
  "height": 675,
  "outputBytes": 98304,
  "input": { "format": "PNG", "width": 2400, "height": 1350, "mode": "RGBA", "sizeBytes": 528310 },
  "savedPercent": 81.4
}
```

A failed image has only `sourceUrl`, `target`, `status: "error"` and `error`.

| Field | Description |
|---|---|
| `sourceUrl` | The URL you sent. |
| `target` | The output format used. |
| `status` | `"ok"` for a converted image, `"error"` for a failed one (not charged). |
| `outputUrl` | Download URL of the converted image. |
| `mime` | MIME type of the output. |
| `width`, `height` | Final dimensions in pixels. |
| `input` | Source metadata: `format`, `width`, `height`, `mode`, `sizeBytes`. |
| `outputBytes` | Output file size in bytes. |
| `savedPercent` | Size reduction compared with the source file, in percent (negative if the output is larger). |
| `error` | Error message (failed images only). |

### How to use it

#### Use from MCP (Claude, Cursor)

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=ent-e/image-converter-compressor"
    }
  }
}
```

Sign in to Apify with OAuth on first connection, then ask, for example: *"Convert this image to WebP under 100 KB and strip the GPS data."* Because this Actor is pay-per-event, agents can also pay per run through Apify's agentic payments.

#### Use from n8n

Add the **Apify** node (`@apify/n8n-nodes-apify`), choose the **Run an Actor and get dataset** operation, select `ent-e/image-converter-compressor`, paste your input JSON, and use each item's `outputUrl`. Or use **Run an Actor** followed by **Get Dataset Items** with the run's `defaultDatasetId`. No community nodes? Use an **HTTP Request** node with the API call below.

#### Use from Make

Add the Apify **Run an Actor** module with **Run synchronously** set to Yes, then **Get Dataset Items** with the run's `defaultDatasetId`, and map `outputUrl` into the next module. Make waits at most 120 seconds for a synchronous run. For big batches, use the **Watch Actor Runs** trigger or an **HTTP** "Make a request" module calling the API below.

#### Use from Zapier

Use the Apify **Run Actor and Fetch Results** action, or **Run Actor** followed by **Fetch Dataset Items**, and map `outputUrl` into your next step.

#### Use from the API

```bash
curl -X POST "https://api.apify.com/v2/acts/ent-e~image-converter-compressor/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/photo.png", "target": "webp", "maxWidth": 1200, "maxBytes": 150000}'
```

Synchronous calls wait up to 5 minutes. For very large batches, start an asynchronous run (`POST /v2/acts/ent-e~image-converter-compressor/runs`) and read the dataset when it finishes.

### FAQ

#### How do I convert an image to WebP from a URL?

Send `{"url": "https://...", "target": "webp"}`. WebP is the default target, so `{"url": "..."}` alone also works. You get a download link to the WebP file.

#### Is there an AVIF converter option?

Yes. Set `"target": "avif"`. AVIF also supports `maxBytes` for a target file size.

#### How do I compress an image to a specific file size, like 100 KB?

Set `maxBytes` in bytes, for example `100000`. Quality is lowered automatically until the image fits. This works for JPEG, WebP and AVIF output. Check `outputBytes` in the result.

#### Does it remove EXIF and GPS location data?

Yes, by default. `stripMetadata` is `true` unless you set it to `false`.

#### Can I bulk compress images?

Yes. Pass a `files` array with as many URLs as you need. You pay $0.001 per image that converts, and failed images are free.

#### Can I use it for n8n image compression or in Make?

Yes. Run the Actor from the Apify integration or an HTTP request, then map `outputUrl` from the results into your next step.

#### What happens to transparency when converting PNG to JPEG?

JPEG has no alpha channel, so transparency is flattened automatically. Use `webp`, `avif` or `png` to keep transparency.

### ENT-E media toolkit

Every tool takes a public file URL, needs nothing installed, charges per file, doesn't charge for failures, and works from MCP, n8n, Make, Zapier and the API.

- **[Media Converter for AI Agents (FFmpeg)](https://apify.com/ent-e/media-converter-ffmpeg)**: audio/video to MP3, Whisper-ready 16 kHz WAV, MP4, WebM, GIF or thumbnails, with trim and batch.
- **[Image Converter & Compressor](https://apify.com/ent-e/image-converter-compressor)**: convert to WebP or AVIF, compress to a target file size, resize, strip EXIF/GPS.
- **[Podcast Loudness Normalizer](https://apify.com/ent-e/podcast-loudness-normalizer)**: normalize to -16, -14, -23 or -24 LUFS with a true-peak ceiling, plus a before/after report.
- **[Video to Captions](https://apify.com/ent-e/video-to-captions-whisper)**: SRT, VTT, TXT and word-level JSON from any video or audio URL, with Whisper.
- **[Video to Shorts](https://apify.com/ent-e/video-to-shorts-captions)**: vertical 9:16 clips with burned-in animated captions for TikTok, Reels and Shorts.

# Actor input Schema

## `url` (type: `string`):

Direct, publicly downloadable URL of ONE image (http/https). Input formats: JPEG, PNG, WebP, AVIF, GIF (first frame), TIFF, BMP, ICO and others Pillow reads. Max 50 MB and 100 megapixels. Example: https://download.samplelib.com/png/sample-boat-400x300.png

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

Optional batch. Array of objects: {"url": string (required), plus any of target, quality, maxWidth, maxHeight, maxBytes, stripMetadata to override the top-level value for that image}. Example: \[{"url":"https://example.com/a.png","target":"avif","maxWidth":800},{"url":"https://example.com/b.jpg","maxBytes":100000}]. Plain URL strings also accepted. Failed images return status=error and are not charged.

## `target` (type: `string`):

Output format. Default: webp. webp = best general web choice; avif = smallest files, slower to encode; jpeg = universal (transparency is flattened onto white); png = lossless, keeps transparency; gif = first frame only; tiff = archival/print.

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

Encoder quality 1-100 for jpeg/webp/avif (ignored for png/gif/tiff). Default 80. ~75-85 is visually lossless for photos; lower = smaller files. If maxBytes is set, this is the starting/maximum quality.

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

Optional maximum output width in pixels, e.g. 1200. Image is downscaled proportionally to fit (aspect ratio kept, never upscaled). Combine with maxHeight to fit inside a box.

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

Optional maximum output height in pixels, e.g. 800. Downscales proportionally (never upscales).

## `maxBytes` (type: `integer`):

Optional target maximum output size in BYTES (e.g. 150000 = ~150 KB). Quality is automatically lowered (binary search) until the file fits. Only for jpeg/webp/avif. If it cannot fit even at very low quality, the item errors (not charged) - add maxWidth to shrink dimensions too.

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

Default true: removes EXIF, GPS location, camera and other metadata from the output (privacy-safe for user uploads). Orientation is applied to pixels first so images stay upright. Set false to keep EXIF (jpeg/webp).

## Actor input object example

```json
{
  "url": "https://download.samplelib.com/png/sample-boat-400x300.png",
  "target": "webp",
  "quality": 80,
  "stripMetadata": true
}
```

# Actor output Schema

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

One dataset row per input URL with status, a download URL (outputUrl) of the converted image, metadata, or an error message.

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

Key-value store holding the converted output files.

# 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 = {
    "url": "https://download.samplelib.com/png/sample-boat-400x300.png"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ent-e/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 = { "url": "https://download.samplelib.com/png/sample-boat-400x300.png" }

# Run the Actor and wait for it to finish
run = client.actor("ent-e/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 '{
  "url": "https://download.samplelib.com/png/sample-boat-400x300.png"
}' |
apify call ent-e/image-converter-compressor --silent --output-dataset

```

## MCP server setup

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