# Bulk Image Converter & Compressor – WebP, AVIF, JPG, Resize (`gazidev/image-converter`) Actor

Convert, compress and resize images in bulk from URLs: JPG, PNG, WebP, AVIF, GIF, TIFF; HEIC/HEIF input. Target file size in KB, fit/cover/pad resizing, strip EXIF/GPS metadata, auto-rotate. Download links for every file. $0.80 per 1,000 images.

- **URL**: https://apify.com/gazidev/image-converter.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Categories:** Developer tools, Automation, E-commerce
- **Stats:** 7 total users, 4 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 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

## Bulk Image Converter & Compressor – WebP, AVIF, JPG, PNG, Resize

Convert, compress and resize **thousands of images from URLs** in one run. Turn product photos into WebP or AVIF for a faster website, shrink images under a target size in KB, resize to exact marketplace dimensions, and strip EXIF/GPS metadata. Every result has a direct download link.

- **Formats:** WebP, AVIF, JPG, PNG, GIF, TIFF and BMP out. JPEG, PNG, WebP, AVIF, **HEIC/HEIF (iPhone)**, TIFF, GIF and BMP in.
- **Compression:** quality 1–100, lossless WebP/PNG, **lossy PNG** (palette, TinyPNG-style), and **target file size** (for example "under 100 KB"). The actor finds the best quality that fits.
- **Resize:** fit inside a box, cover (crop to exact size), pad to exact size with a background colour, or stretch. Small images aren't enlarged unless you allow it.
- **Privacy:** EXIF, GPS and camera data are stripped by default; the colour profile is kept. Images are auto-rotated by their EXIF orientation.
- **Bulk sources:** a URL list, pasted text or CSV, a Google Sheet, or the dataset of another Actor (for example a product scraper or our Image Downloader).

### Pricing

**$0.0008 per converted image ($0.80 per 1,000).** Failed downloads and invalid files are free. The run stops cleanly at your *maximum cost per run*.

### Input examples

WebP for your website, max 1600 px wide:

```json
{ "imageUrls": ["https://example.com/a.jpg"], "outputFormat": "webp", "quality": 80, "width": 1600, "resizeMode": "fit" }
```

Square 2000×2000 product images on a white background (Amazon/Etsy style):

```json
{ "datasetId": "<dataset of a scraper>", "datasetField": "imageUrl", "outputFormat": "jpg", "width": 2000, "height": 2000, "resizeMode": "pad", "backgroundColor": "#ffffff", "allowUpscale": true }
```

Every image under 150 KB:

```json
{ "bulkText": "https://...\nhttps://...", "outputFormat": "jpg", "targetKb": 150 }
```

### Output

```json
{
  "url": "https://example.com/a.jpg",
  "status": "ok",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/<id>/records/00001-a-1a2b3c.webp",
  "sourceFormat": "jpeg", "format": "webp",
  "inputWidth": 4032, "inputHeight": 3024, "outputWidth": 1600, "outputHeight": 1200,
  "inputBytes": 3512345, "outputBytes": 182311, "savedPercent": 94.8,
  "quality": 80, "metadataStripped": true
}
```

The files are in the run's key-value store, and the *Run summary* shows the total MB saved. Errors are free rows, for example `{"status": "error", "errorCode": "HTTP_404"}`. Error codes: `INVALID_URL`, `HTTP_4xx/5xx`, `TIMEOUT`, `TOO_LARGE`, `NOT_AN_IMAGE`, `DECODE_ERROR`.

### Use cases

- **Web performance / Core Web Vitals:** batch-convert site images to WebP or AVIF.
- **E-commerce:** marketplace-ready sizes, square padding, and file size limits.
- **iPhone HEIC to JPG** in bulk.
- **Privacy:** remove GPS location from photos before publishing.
- **Pipelines:** scrape images with any Actor, then convert them here.

### Related Actors by gazidev

AI Image Upscaler (Real-ESRGAN) · Image Downloader · Image Metadata & EXIF Extractor · Image OCR

# Actor input Schema

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

Direct links to JPEG, PNG, WebP, HEIC/HEIF, AVIF, TIFF, GIF (first frame) or BMP files. Duplicates are removed; invalid values and failed downloads are reported for free.

## `bulkText` (type: `string`):

One URL per line, or a CSV with a `url` / `image` column.

## `sourceFileUrl` (type: `string`):

Public .txt or .csv link (Google Sheets 'Publish to web → CSV' works).

## `datasetId` (type: `string`):

Chain after a scraper (e.g. product images) or our Image Downloader.

## `datasetField` (type: `string`):

Arrays of URLs are accepted too.

## `outputFormat` (type: `string`):

HEIC/HEIF inputs are converted to JPG when 'Same as input' is chosen.

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

For JPG, WebP and AVIF (and for lossy PNG when enabled below).

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

Pixel-perfect WebP or full-colour PNG.

## `pngPalette` (type: `boolean`):

Reduces PNGs to up to 256 colours (quality controls the palette size), often 60–80% smaller, like TinyPNG. Off = normal lossless PNG.

## `targetKb` (type: `integer`):

Finds the highest quality that fits under this size (JPG, WebP, AVIF); shrinks the image if even the lowest quality is too big. 0 = off.

## `resizeMode` (type: `string`):

Only used when width and/or height are set.

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

0 or empty = auto.

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

0 or empty = auto.

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

Off = images smaller than the box are kept at their size (fit mode). For AI upscaling use our AI Image Upscaler.

## `backgroundColor` (type: `string`):

Used for 'pad' mode and when transparent images are saved as JPG/BMP.

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

Off (default) strips EXIF, GPS location and camera data for privacy and smaller files; the colour profile is kept.

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

Fixes sideways phone photos.

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

Black-and-white output (transparency kept).

## `maxImages` (type: `integer`):

0 = no limit.

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

Larger files are skipped for free.

## `maxConcurrency` (type: `integer`):

Lower it for slow or rate-limited hosts.

## `proxyConfiguration` (type: `object`):

Only needed if an image host blocks datacenter IPs.

## Actor input object example

```json
{
  "imageUrls": [
    "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png",
    "https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/gps/DSCN0010.jpg"
  ],
  "datasetField": "url",
  "outputFormat": "webp",
  "quality": 82,
  "lossless": false,
  "pngPalette": false,
  "targetKb": 0,
  "resizeMode": "fit",
  "allowUpscale": false,
  "backgroundColor": "#ffffff",
  "keepMetadata": false,
  "autoRotate": true,
  "grayscale": false,
  "maxImages": 0,
  "maxFileSizeMb": 50,
  "maxConcurrency": 6
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

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

No description

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

No description

## `summary` (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 = {
    "imageUrls": [
        "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png",
        "https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/gps/DSCN0010.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/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": [
        "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png",
        "https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/gps/DSCN0010.jpg",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gazidev/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": [
    "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png",
    "https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/gps/DSCN0010.jpg"
  ]
}' |
apify call gazidev/image-converter --silent --output-dataset

```

## MCP server setup

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