# Image Converter & Optimizer — HEIC, WebP, AVIF (API) (`synthetic.ia/image-converter`) Actor

Convert, resize, compress and strip metadata from images in bulk. Reads HEIC/HEIF (iPhone photos), JPEG, PNG, WebP, AVIF, TIFF, GIF; writes JPEG/PNG/WebP/AVIF/TIFF/GIF. Clean HTTP API + MCP, no key. Pay per image.

- **URL**: https://apify.com/synthetic.ia/image-converter.md
- **Developed by:** [Synthetic](https://apify.com/synthetic.ia) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 image processeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 & Optimizer — HEIC, WebP, AVIF, resize (API)

Convert, resize, compress and strip metadata from images — one at a time or in bulk — behind a clean HTTP API (and MCP tool). Reads **HEIC/HEIF** (iPhone photos), JPEG, PNG, WebP, AVIF, TIFF and GIF; writes **JPEG, PNG, WebP, AVIF, TIFF or GIF**. Powered by libvips (sharp), so it's fast and lightweight. **No API key.** Pay per image.

- 📱 **HEIC → anything** — turn iPhone `.heic/.heif` photos into JPG/PNG/WebP/AVIF in seconds.
- 🗜️ **Optimize & shrink** — re-encode to **WebP/AVIF** with quality control; typical 40–80% smaller.
- 📐 **Resize** — cap width/height with aspect-ratio-safe fit modes (inside/cover/contain/fill/outside).
- 🔒 **Strip metadata** — remove EXIF/GPS by default (privacy + size); keep it if you prefer.
- 🎨 **Grayscale**, transparent-to-JPEG flatten (choose the background colour).
- 🧺 **Bulk** — up to 100 images per run; each returned as a downloadable URL with the size saved.
- 💵 Pay per image · no key.

### The use case it was built for

Every app that accepts user photos hits the same wall: iPhones upload HEIC, files are huge, and EXIF leaks location. This Actor is a drop-in image pipeline — send URLs or base64, get back optimized images and a report of how much you saved. Wire it into an upload flow, a scraper that needs thumbnails, or an agent (over MCP) that has to normalize images before doing anything else.

### Sample output

```json
{
  "ok": true, "format": "webp", "count": 2, "converted": 2,
  "results": [
    { "index": 0, "url": "https://api.apify.com/v2/key-value-stores/…/records/img-….webp",
      "format": "webp", "width": 800, "height": 600, "bytes": 41207, "sourceBytes": 210548,
      "sourceFormat": "heif", "savedPct": 80 }
  ]
}
```

Each `url` is a public, ready-to-download link to the processed image.

### How to use

- **HTTP API (Standby):** `POST /convert` with `{ images, format, quality, width, height, fit, stripMetadata, grayscale, background }`. `GET /` returns help.
- **Normal run / bulk job:** pass the same fields as the actor input; results land in the dataset + key-value store.
- **MCP tool:** expose it to your agent through Apify's MCP server.

### Input

- **images** — one or more image URLs or base64 strings (max 100).
- **format** — `webp` (default) · `jpeg` · `png` · `avif` · `tiff` · `gif` · `keep`.
- **quality** — 1–100 (lossy formats). Default 80.
- **width / height** — optional max dimensions (px). **fit** — `inside` (default), `cover`, `contain`, `fill`, `outside`.
- **stripMetadata** — remove EXIF/GPS (default true). **grayscale** — black & white. **background** — hex fill when flattening transparency to JPEG.

### Pricing

**Per image** from **$0.005** (down to $0.002 on higher tiers). A run of 20 photos = 20 images. No key, no proxy — this is pure compute.

### Related Actors

- **[ffmpeg API](https://apify.com/synthetic.ia/ffmpeg-api)** — the same idea for audio/video (convert, trim, compress, thumbnails).
- **[Media Downloader](https://apify.com/synthetic.ia/media-downloader)** — grab media from 1800+ sites, then optimize it here.

### FAQ

**Does it really read HEIC?** Yes — iPhone `.heic/.heif` decode is built in; convert them to JPG/PNG/WebP/AVIF.

**Where do the converted images go?** Each output is stored and returned as a public URL you can download or hotlink.

**Is there a size/'count' limit?** Up to 100 images per run and 30 MB per source image.

**Can it just optimize without changing format?** Use `format: "keep"` to re-encode in the source format (still resizes/compresses/strips).

### Notes & limits

Animated GIF/WebP are handled frame-aware. HEIC *encode* is not supported (that format is patent-encumbered) — read HEIC, write JPG/WebP/AVIF/PNG instead.

# Changelog

This Actor's version history is a separate document: https://apify.com/synthetic.ia/image-converter/changelog.md

# Actor input Schema

## `images` (type: `array`):

One or more images to process — http(s) URLs or base64 (HEIC/HEIF, JPEG, PNG, WebP, AVIF, TIFF, GIF). Up to 100 per run.

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

Target format. 'keep' preserves the source format.

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

Compression quality for lossy formats (JPEG/WebP/AVIF/TIFF). Lower = smaller file.

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

Resize to at most this width (keeps aspect ratio with the default fit). Leave empty to keep size.

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

Resize to at most this height. Leave empty to keep size.

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

How to fit within width/height. 'inside' keeps aspect ratio without cropping; 'cover' crops to fill.

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

Remove EXIF/GPS/other metadata (recommended for privacy & size). Turn off to keep it.

## `grayscale` (type: `boolean`):

Convert to black & white.

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

Hex colour used to fill transparency when converting a transparent image to JPEG.

## Actor input object example

```json
{
  "images": [
    "https://picsum.photos/seed/synthetic/800/600"
  ],
  "format": "webp",
  "quality": 80,
  "fit": "inside",
  "stripMetadata": true,
  "grayscale": false,
  "background": "#ffffff"
}
```

# Actor output Schema

## `result` (type: `string`):

The conversion result JSON (per-image URLs + sizes).

## `runs` (type: `string`):

No description

# 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("synthetic.ia/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("synthetic.ia/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 synthetic.ia/image-converter --silent --output-dataset

```

## MCP server setup

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