# Image Converter — WebP · AVIF · JPEG · PNG (Resize + Batch) (`eliai/image-converter`) Actor

Convert images between WebP, AVIF, JPEG, PNG, GIF and TIFF with optional resizing, quality control and metadata stripping. Batch URLs in, converted files + direct download links out. $0.004 per image converted; failures are never charged.

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

## Pricing

$4.00 / 1,000 image conversions

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Image Converter — WebP · AVIF · JPEG · PNG · GIF · TIFF

Batch-convert images between modern and classic formats with optional **resizing, quality control and metadata stripping**. Feed it public image URLs; it returns one converted file per image in the run's key-value store, with a **direct download URL, dimensions, byte sizes and the exact space saved** in every dataset row.

Powered by libvips (sharp) — the same engine behind most production image CDNs — so conversions are fast and color-accurate.

### Try it free first

Run the actor with **no input at all** and it converts a built-in demo image (unbilled) so you can see the exact output shape before spending anything.

### What it does

- **Formats:** WebP, AVIF, JPEG, PNG, GIF, TIFF — any direction. Animated GIF/WebP inputs keep their animation when converting between those two.
- **Resize:** target width/height with five fit modes (`inside`, `cover`, `contain`, `fill`, `outside`). Images are **never upscaled**.
- **Quality:** 1–100 for lossy formats. WebP at quality 80 typically cuts a JPEG's size 25–35%; AVIF often more.
- **Privacy by default:** EXIF/GPS/ICC metadata is stripped unless you set `keepMetadata`. Orientation is applied to the pixels first, so photos never come out sideways.
- **Honest billing:** you pay per successfully converted image. Dead URLs, non-images, and oversized sources are recorded in the dataset but **never charged**. Output is stored before the charge, so hitting your spending limit never loses finished work.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `imageUrls` | string\[] | `[]` | Empty = free demo conversion |
| `format` | enum | `webp` | webp / avif / jpeg / png / gif / tiff |
| `quality` | integer | `80` | Lossy formats only |
| `width` / `height` | integer | `0` | `0` keeps original; never upscales |
| `fit` | enum | `inside` | Used when both width & height are set |
| `keepMetadata` | boolean | `false` | Keep EXIF/ICC |
| `maxFileSizeMb` | integer | `50` | Larger sources skipped (unbilled) |

### Example output

```json
{
  "sourceUrl": "https://example.com/photo.jpg",
  "outputFormat": "webp",
  "fileKey": "image-0001.webp",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/image-0001.webp",
  "sourceFormat": "jpeg",
  "sourceWidth": 4032,
  "sourceHeight": 3024,
  "width": 1600,
  "height": 1200,
  "bytesIn": 2871442,
  "bytesOut": 214930,
  "savedPercent": 92.5,
  "convertedAt": "2026-08-03T19:30:00.000Z"
}
```

### Run it from the API

```bash
curl -X POST "https://api.apify.com/v2/acts/<username>~image-converter/run-sync-get-dataset-items?token=<YOUR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"imageUrls":["https://example.com/photo.jpg"],"format":"webp","width":1600,"quality":80}'
```

Each row's `downloadUrl` serves the converted file directly — pipe it into the next step of your workflow, no unzipping.

### Honest limits

- Sources are capped at `maxFileSizeMb` (max 100 MB) and 60 s download time each.
- SVG input is rasterized at its intrinsic size; fonts inside SVGs may not render.
- AVIF encoding is the slowest of the six formats — expect a few seconds per large photo.
- The actor fetches only the public URLs you explicitly supply — no crawling, no login-walled content.

### Pricing

**$0.004 per image converted** — billed as the `image-converted` event, only on success: dead URLs, non-images, and oversized sources are recorded but never charged, and output is stored before the charge so a spending cap never loses finished work. Run with no input at all for a free, unbilled demo conversion.

### FAQ

**How do I convert an image to WebP (or AVIF) by URL?** Put the URLs in `imageUrls`, set `format`, run — each row returns a `downloadUrl` serving the converted file directly, plus byte sizes and the exact percentage saved.

**How much smaller do images get?** WebP at quality 80 typically cuts a JPEG's size 25–35%; AVIF usually more. Every result reports `bytesIn`, `bytesOut`, and `savedPercent`, so the answer for your images is measured, not estimated.

**Can it resize images too?** Yes — set `width`/`height` with one of five fit modes. Images are never upscaled, so thumbnails stay sharp and originals stay untouched.

**Does it keep EXIF and GPS metadata?** Stripped by default for privacy (set `keepMetadata` to keep it). Orientation is applied to the pixels first, so photos never come out sideways.

**Do animated GIFs stay animated?** Yes when converting between GIF and WebP — the two animated formats. Converting an animation to a still format keeps the first frame.

**Is there a free way to test the output format?** Run with no input at all — a built-in demo image is converted unbilled so you can inspect the exact output shape before spending anything.

# Actor input Schema

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

Public image URLs to convert — one converted file and one dataset row each. Leave empty to convert a built-in demo image (free) so you can see the exact output format before spending anything.

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

Target format. WebP and AVIF give the smallest files for the web; PNG is lossless; TIFF for print pipelines.

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

Compression quality for lossy formats (WebP, AVIF, JPEG). Ignored for PNG/GIF.

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

Target width in pixels. 0 keeps the original width. Images are never upscaled.

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

Target height in pixels. 0 keeps the original height. Images are never upscaled.

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

How the image fits the target box when both width and height are set. `inside` preserves aspect ratio within the box; `cover` fills and crops.

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

Off (default) strips EXIF/GPS/ICC for smaller, privacy-safe files. Orientation is always applied to the pixels first, so photos never come out rotated.

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

Source images larger than this are skipped (recorded, never charged).

## Actor input object example

```json
{
  "imageUrls": [],
  "format": "webp",
  "quality": 80,
  "width": 0,
  "height": 0,
  "fit": "inside",
  "keepMetadata": false,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

Every item this run produced, as JSON.

## `resultsCsv` (type: `string`):

The same items as a spreadsheet-ready CSV.

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

Files this run produced (images, screenshots, reports).

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/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 = {}

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

```

## MCP server setup

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