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

Bulk convert, resize and compress images from links to WebP, AVIF, JPEG, PNG, TIFF or GIF. Keeps orientation, strips metadata, shows bytes saved. Download links for every file. Pay per image.

- **URL**: https://apify.com/docsmith/image-converter.md
- **Developed by:** [Docsmith Tools](https://apify.com/docsmith) (community)
- **Categories:** Developer tools, Automation, E-commerce
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 images converted

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

Convert, resize and compress **hundreds of images in one run**. Give it image links and pick a format. You get a **download link for every converted file**, plus the new size and how much space you saved.

### Why use it

- **Every common format.** Output WebP, AVIF, JPEG, PNG, TIFF or GIF from JPEG, PNG, WebP, AVIF, GIF, TIFF or SVG.
- **Smaller pages.** WebP and AVIF are often 30% to 80% smaller than JPEG or PNG. Each result shows `savedPercent`.
- **Resize to fit.** Max width/height with fit, crop (cover), pad (contain) or stretch. No accidental upscaling.
- **Privacy by default.** EXIF, GPS and camera data are removed unless you choose to keep them. Photos are auto-rotated.
- **Built for pipelines.** Chain it after any tool that outputs image URLs, or call it from Make, Zapier, n8n or code. Optional Base64 output.
- **Fast and cheap.** Powered by libvips (sharp). No AI model, no scraping.

### Input

| Field | What it does |
| --- | --- |
| Image links | Direct links to images, up to 50 MB each |
| Output format | WebP (default), AVIF, JPEG, PNG, TIFF or GIF |
| Quality | 1 to 100 (default 80) |
| Max width / height | Resize target in pixels (0 = keep) |
| Resize mode | inside, cover, contain, fill, outside |
| Lossless | Lossless WebP/AVIF |
| Keep metadata | Keep EXIF/GPS (off by default) |
| Include Base64 | Put the image data in the dataset too |

### Output (one dataset item per image)

```json
{
  "url": "https://example.com/photo.png",
  "success": true,
  "fileName": "00001-photo.webp",
  "downloadUrl": "https://api.apify.com/v2/key-value-stores/.../records/00001-photo.webp",
  "format": "webp",
  "input": { "format": "png", "width": 3000, "height": 2000, "bytes": 5242880 },
  "output": { "width": 1200, "height": 800, "bytes": 98304 },
  "savedPercent": 98.1
}
```

Failed images return `"success": false` with an `error` message and are not charged.

### Pricing

Pay per image converted. Failed downloads and unreadable files are free. Set a maximum cost per run and the tool stops cleanly before going over it.

### How much does it cost to convert images?

You pay **US$0.0015 per image** (plus a small amount of Apify platform usage). **1,000 images cost about US$1.50.** Failed images are free. Apify's free plan includes monthly credit, so small batches can cost nothing.

### How to convert images to WebP in bulk

1. Click **Try for free**.
2. Add image links, or upload a text file of links.
3. Choose **WebP** (or AVIF, JPEG, PNG), a quality and an optional max width.
4. Click **Start**, then download each file from its `downloadUrl` or from the run's key-value store.

### FAQ

**Can I convert PNG to WebP, JPG to WebP, or WebP to JPG?** Yes, any of the supported input formats to any output format.

**How much smaller will my images get?** It depends on the image, but WebP is usually 25% to 35% smaller than JPEG at similar quality, and AVIF smaller again. Each result shows `savedPercent`.

**Does it remove EXIF and GPS data?** Yes, by default. Turn on **Keep metadata** if you need it.

**Can I use it in Make, Zapier or n8n?** Yes. Use the Apify app or the HTTP API, send image URLs, and read back the download links.

**Can it resize images for ecommerce or thumbnails?** Yes. Set a max width and height and choose *cover* for exact-size crops, or *contain* to pad with a background colour.

### Use it from code or AI agents

Call it with the Apify API, the JavaScript or Python client, or through Apify's MCP server.

### Other Docsmith tools

- [Document to Markdown](https://apify.com/docsmith/document-to-markdown): convert PDF, Word, Excel and PowerPoint files to Markdown and JSON for AI and RAG.
- [Email Security Audit](https://apify.com/docsmith/email-security-audit): check SPF, DKIM, DMARC and SSL for many domains, with a grade and fixes.
- [RSS Feed Reader & Monitor](https://apify.com/docsmith/rss-feed-reader): turn RSS, Atom and JSON feeds into JSON, with only-new-items alerts.
- [Bulk URL Status Checker](https://apify.com/docsmith/url-status-checker): find broken links, redirect chains and expiring SSL certificates.

# Actor input Schema

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

Direct links to images (JPEG, PNG, WebP, AVIF, GIF, TIFF, SVG, HEIC where supported). Up to 50 MB each.

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

Format to convert to. WebP and AVIF give the smallest files for the web.

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

Lower means smaller files. 75 to 85 suits most web images.

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

Resize to this width (0 = keep original).

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

Resize to this height (0 = keep original).

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

inside: fit within the box, keep aspect ratio. cover: fill the box and crop. contain: fit and pad. fill: stretch.

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

Let small images be enlarged to the requested size.

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

Lossless compression. Bigger files, no quality loss.

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

Off by default, so camera and location data is removed.

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

Used when flattening transparency to JPEG or padding with contain.

## `includeBase64` (type: `boolean`):

Also put each converted image in the dataset as Base64 text. Handy for small images and no-code tools.

## `concurrency` (type: `integer`):

How many images to process at once.

## Actor input object example

```json
{
  "images": [
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    }
  ],
  "format": "webp",
  "quality": 80,
  "width": 0,
  "height": 0,
  "fit": "inside",
  "allowUpscale": false,
  "lossless": false,
  "keepMetadata": false,
  "background": "#ffffff",
  "includeBase64": false,
  "concurrency": 4
}
```

# Actor output Schema

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

All images with download links, dimensions and savings.

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

Summary table of converted images.

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

Key-value store holding the converted image files.

# 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 = {
    "images": [
        {
            "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("docsmith/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 = { "images": [{ "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png" }] }

# Run the Actor and wait for it to finish
run = client.actor("docsmith/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 '{
  "images": [
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    }
  ]
}' |
apify call docsmith/image-converter --silent --output-dataset

```

## MCP server setup

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