# Image Converter & Resizer (HEIC, AVIF, WebP, PNG, JPG) (`toowl/image-converter`) Actor

Convert, resize and compress images in bulk from URLs: HEIC/HEIF (iPhone), AVIF, WebP, PNG, JPG, TIFF, GIF and SVG in, JPG/PNG/WebP/AVIF/TIFF/GIF out. EXIF rotation applied, metadata stripped by default. Pay per image.

- **URL**: https://apify.com/toowl/image-converter.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.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.

Learn more: https://docs.apify.com/actors/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 & Resizer — HEIC, AVIF, WebP, PNG, JPG in bulk

Convert, resize and compress images in bulk from URLs. Turn iPhone **HEIC photos into JPG**, product photos into **WebP or AVIF** for a faster website, or shrink PNGs TinyPNG-style — hundreds at a time.

### Formats

- **In**: HEIC / HEIF (iPhone, Samsung), AVIF, WebP, PNG, JPG, TIFF, GIF (incl. animated), SVG
- **Out**: WebP, JPG, PNG, AVIF, TIFF, GIF

### Features

- **Resize** to a max width/height, with `inside` (keep ratio), `cover` (crop to fill), `contain` (pad), `fill` or `outside`. Never upscales unless you allow it.
- **Compress**: mozjpeg for JPG, palette-quantized PNG (like TinyPNG) when quality < 100, WebP/AVIF lossy or lossless.
- **EXIF rotation applied**, so photos come out the right way up.
- **Privacy by default**: EXIF, GPS and camera metadata are stripped (turn on `keepMetadata` to keep them).
- **Transparency** is flattened onto your background colour when converting to JPG.
- **Pay only for images that worked.**

### Input

```json
{
  "files": [
    { "url": "https://example.com/IMG_0001.HEIC" },
    { "url": "https://example.com/banner.png" }
  ],
  "format": "webp",
  "quality": 80,
  "width": 1600
}
```

| Field | Default | Notes |
| --- | --- | --- |
| `files` | — | Image URLs |
| `format` | `webp` | `webp`, `jpg`, `png`, `avif`, `tiff`, `gif` |
| `quality` | 80 | 1–100 |
| `width`, `height` | — | Max box; leave empty to keep size |
| `fit` | `inside` | `inside`, `cover`, `contain`, `fill`, `outside` |
| `allowUpscale` | false | |
| `background` | `#ffffff` | JPG flattening and `contain` padding |
| `lossless` | false | WebP/AVIF lossless, full-colour PNG, LZW TIFF |
| `keepMetadata` | false | Keep EXIF/GPS/ICC |
| `maxFileSizeMb` | 50 | |

### Output

Converted files are stored in the run's key-value store; the dataset has one row per image:

```json
{
  "url": "https://example.com/IMG_0001.HEIC",
  "name": "IMG_0001.HEIC",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/…/records/0001-IMG_0001.webp",
  "inputFormat": "heif",
  "outputFormat": "webp",
  "width": 1600,
  "height": 1198,
  "sizeBefore": 2994394,
  "sizeAfter": 233104,
  "savedPercent": 92.2
}
```

### Integrations

Run it from the Apify API, Zapier, Make, n8n or a webhook: e.g. convert every new Shopify/WooCommerce product image to WebP, or every HEIC upload in a Drive folder to JPG.

### Pricing

Pay per event: a small fee per converted image (see the Pricing tab). Failed images are free. Cap spending with "Max cost per run".

### Free browser version

Converting a few files by hand? Use [toowl.my.id/tools/convert-image](https://toowl.my.id/tools/convert-image/) — free, runs in your browser.

# Actor input Schema

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

Direct links to the images. Accepted: HEIC/HEIF, AVIF, WebP, PNG, JPG, TIFF, GIF, SVG.

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

File type of the converted images.

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

1–100. For PNG below 100 the image is palette-quantized (much smaller, like TinyPNG).

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

Leave empty to keep the original size.

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

Leave empty to keep the original size.

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

inside = keep aspect ratio within the box. cover = fill the box and crop. contain = fit and pad with the background colour. fill = stretch.

## `allowUpscale` (type: `boolean`):

By default smaller images are never enlarged.

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

Used when flattening transparency to JPG and for 'contain' padding.

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

Lossless WebP/AVIF, full-colour PNG, LZW TIFF.

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

Off by default: location and camera data are removed.

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

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://toowl.my.id/og.png"
    }
  ],
  "format": "webp",
  "quality": 80,
  "fit": "inside",
  "allowUpscale": false,
  "background": "#ffffff",
  "lossless": false,
  "keepMetadata": false,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

One row per input file, with a download link for the result where there is one.

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

Result files in the default key-value store, plus a SUMMARY record.

# 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 = {
    "files": [
        {
            "url": "https://toowl.my.id/og.png"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/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 = { "files": [{ "url": "https://toowl.my.id/og.png" }] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/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 '{
  "files": [
    {
      "url": "https://toowl.my.id/og.png"
    }
  ]
}' |
apify call toowl/image-converter --silent --output-dataset

```

## MCP server setup

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