# Image Converter & Compressor: WebP, AVIF, JPG, PNG, HEIC Resize (`gmyri/image-converter`) Actor

Batch convert, compress and resize images: JPG, PNG, WebP, AVIF, HEIC, GIF, TIFF, BMP. Target file size, strip EXIF, ZIP download. $1 per 1,000 images.

- **URL**: https://apify.com/gmyri/image-converter.md
- **Developed by:** [Giorgos Myrianthous](https://apify.com/gmyri) (community)
- **Categories:** Developer tools, Automation, 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.00 / 1,000 images

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: WebP, AVIF, JPG, PNG, HEIC Resize

**Batch image converter, compressor and resizer:** JPG, PNG, **WebP**, **AVIF**, GIF, TIFF, BMP, ICO and PDF, with **HEIC to JPG**, a **target file size** (e.g. under 100 KB), resize or crop to thumbnails, EXIF stripping and a ZIP of all results.

💲 **$1 per 1,000 images.** Failed images are free. Pay only for results. No subscription, and the Apify free plan's monthly credit covers small jobs.

**Also known as:** image converter, image compressor, convert to WebP, PNG to WebP, JPG to WebP, HEIC to JPG, AVIF converter, image resizer, bulk image optimizer, thumbnail generator.

### Try it now (free-plan friendly)

1. Click **Start**. The prefilled input works as is. Converts two sample images to WebP and saves 80% of their size in about 3 seconds.
2. Or paste this input into the JSON tab:

```json
{
  "imageUrls": [
    {
      "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg"
    }
  ],
  "format": "webp",
  "quality": 80
}
```

**Example output** (one dataset item, shortened):

```json
{
  "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png",
  "status": "ok",
  "inputFormat": "png",
  "inputBytes": 30605,
  "outputFormat": "webp",
  "width": 128,
  "height": 128,
  "outputBytes": 3616,
  "savingsPercent": 88.2,
  "outputUrl": "https://api.apify.com/v2/key-value-stores/…/records/hopper.webp"
}
```

Small runs cost cents, and you can set a **Max cost per run** so you're never charged more.

### Use with AI agents / Apify MCP

Give your agent (Claude, ChatGPT, Cursor, n8n AI Agent, LangChain, OpenAI Agents SDK) this tool through **Apify's MCP server**:

```text
https://mcp.apify.com?tools=gmyri/image-converter
```

- **Example prompt:** "Convert these product photos to WebP under 150 KB each: \[...]"
- **Why agents like it:** the input has one required field and documented defaults and enums. The output has stable, flat field names, errors are returned as items with an `error` field and are never charged, and each run writes a summary to the `OUTPUT` record.
- Agents that use `search-actors` find it by searching for: image converter, image compressor.

### API, Python, n8n, Make, Zapier

```bash
curl -X POST "https://api.apify.com/v2/acts/gmyri~image-converter/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"imageUrls":[{"url":"https://example.com/photo.heic"}],"format":"jpeg","maxWidth":1600,"targetMaxKB":300}'
```

- **Python:** `ApifyClient(token).actor("gmyri/image-converter").call(run_input={...})`
- **n8n / Make / Zapier:** use the Apify "Run Actor" action with `gmyri/image-converter`, then read the dataset items.

### Quick FAQ

- **Can I convert HEIC (iPhone) photos?** Yes. HEIC/HEIF, AVIF, WebP, TIFF, BMP and GIF inputs are supported.
- **Can it hit an exact file size?** Set `targetMaxKB`. For JPEG/WebP/AVIF it lowers quality step by step, and shrinks dimensions only if quality alone isn't enough.
- **What if I set a spending limit?** The Actor stops cleanly at your *Max cost per run* and you're never charged above it.

### Details

### What it does

- **Convert images in bulk:** JPG, PNG, **WebP**, **AVIF**, GIF, TIFF, BMP, ICO (favicons) and PDF. Reads **HEIC/HEIF** (iPhone photos), AVIF, WebP, TIFF, BMP, GIF and more.
- **Compress:** quality control, lossless WebP/PNG, PNG palette compression, and a **target file size** (e.g. "under 100 KB") that automatically lowers quality and, if needed, dimensions.
- **Resize:** fit inside max width/height (never upscales) or **crop to fill** for exact thumbnails.
- **Privacy:** strips EXIF (camera, GPS location) by default, auto-rotates photos, and keeps colour profiles.
- **Download:** every image gets a direct URL, and you can also get one **ZIP** with all files.

### Typical uses

- Convert a product catalogue or blog image library to WebP/AVIF for faster pages and better Core Web Vitals.
- HEIC to JPG for uploads and CMSs.
- Thumbnails and social images at exact sizes.
- Post-process images from other Apify scrapers (pass their image URLs) or from AI agents.

### Input

| Field | Description |
|---|---|
| `imageUrls` | Direct image URLs. |
| `format` | `webp` (default), `avif`, `jpeg`, `png`, `gif`, `tiff`, `bmp`, `ico`, `pdf` or `same`. |
| `quality` | 1–100 (default 80). |
| `lossless` | Lossless WebP/PNG. |
| `maxWidth`, `maxHeight`, `fit` | Resize options. |
| `targetMaxKB` | Compress until the file is under this size. |
| `keepMetadata`, `autoRotate` | EXIF handling. |
| `createZip` | Also save `images.zip`. |

### Pricing

Pay per event: **$0.001 per image ($1 per 1,000 images)** plus Apify's standard $0.00005 Actor start. Failed images (bad URL, not an image) are free.

### Notes

- Max 60 MB and 120 megapixels per image. Animated GIF/WebP are converted from the first frame.
- Only process images you have the right to use. Converted files are stored in your own Apify key-value store.

### Related tools

- [Website Screenshot API: Full Page, Mobile & URL to PDF](https://apify.com/gmyri/website-screenshot)
- [OCR Image to Text & Scanned PDF to Text (Tesseract, 100+ langs)](https://apify.com/gmyri/image-pdf-ocr)
- [PageSpeed & Core Web Vitals Checker: Bulk Lighthouse Audit](https://apify.com/gmyri/pagespeed-checker)

💡 **Need several checks per site?** [Website Audit All-in-One](https://apify.com/gmyri/website-audit) runs SEO, broken links, PageSpeed, tech stack and SSL/DNS checks in one report for $0.03 per site.

All tools by gmyri: [doc-to-markdown](https://apify.com/gmyri/doc-to-markdown), [dataset-merge-dedup](https://apify.com/gmyri/dataset-merge-dedup), [site-health-audit](https://apify.com/gmyri/site-health-audit), [website-screenshot](https://apify.com/gmyri/website-screenshot), [domain-health-check](https://apify.com/gmyri/domain-health-check), [image-pdf-ocr](https://apify.com/gmyri/image-pdf-ocr), [tech-stack-detector](https://apify.com/gmyri/tech-stack-detector), [rss-feed-reader](https://apify.com/gmyri/rss-feed-reader), [pagespeed-checker](https://apify.com/gmyri/pagespeed-checker), [website-audit](https://apify.com/gmyri/website-audit), [audio-transcriber](https://apify.com/gmyri/audio-transcriber), [wayback-machine-snapshots](https://apify.com/gmyri/wayback-machine-snapshots).

# Actor input Schema

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

Direct image URLs (public or signed links, e.g. S3, Dropbox, Apify key-value store). You can also upload a text file with one URL per line.

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

Target format. HEIC/HEIF inputs are supported (convert HEIC to JPG/WebP).

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

Lossy quality for JPEG/WebP/AVIF (PNG: below 100 enables 256-colour compression).

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

Lossless WebP/PNG.

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

Resize to fit this width (keeps aspect ratio, never upscales). 0 = no limit.

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

Resize to fit this height. 0 = no limit.

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

'cover' crops to exactly maxWidth x maxHeight.

## `targetMaxKB` (type: `integer`):

JPEG/WebP/AVIF: lower quality (and size if needed) until the file is under this size. 0 = off.

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

By default EXIF (camera, GPS location) is stripped for privacy and smaller files.

## `autoRotate` (type: `boolean`):

Apply the EXIF orientation so photos display upright.

## `createZip` (type: `boolean`):

Also save images.zip with every converted file.

## `timeoutSecs` (type: `integer`):

Per-image download timeout.

## Actor input object example

```json
{
  "imageUrls": [
    {
      "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg"
    },
    {
      "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
    }
  ],
  "format": "webp",
  "quality": 80,
  "lossless": false,
  "maxWidth": 0,
  "maxHeight": 0,
  "fit": "inside",
  "targetMaxKB": 0,
  "keepMetadata": false,
  "autoRotate": true,
  "createZip": false,
  "timeoutSecs": 60
}
```

# Actor output Schema

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

One item per image with download URL and sizes.

## `summary` (type: `string`):

Totals, savings and the ZIP link (if enabled).

# 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://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg"
        },
        {
            "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gmyri/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": [
        { "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg" },
        { "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gmyri/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": [
    {
      "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg"
    },
    {
      "url": "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
    }
  ]
}' |
apify call gmyri/image-converter --silent --output-dataset

```

## MCP server setup

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