# Image Converter: JPG, PNG, WebP, AVIF with Resize (`ucchiii/image-converter`) Actor

Image converter for public image URLs: JPG, PNG, WebP, GIF, BMP or TIFF to JPG, PNG, WebP or AVIF, with optional max width and height that keep the aspect ratio. Each image gets a download link and a row with sizes before and after. Empty input = free demo.

- **URL**: https://apify.com/ucchiii/image-converter.md
- **Developed by:** [Actor Factory](https://apify.com/ucchiii) (community)
- **Categories:** Developer tools, Automation, Integrations
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 converted images

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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 for image URLs: JPG, PNG, WebP, GIF, BMP and TIFF to JPG, PNG, WebP or AVIF, with optional resize**

Paste image links, pick the output format, optionally set a maximum width or height, and press Start. Every image is converted, saved in the run's storage with a download link, and listed as one row with the formats, file size before and after, and the new width and height. One flat price per image, whatever its size.

### What you get

| sourceUrl | status | outputFormat | inputBytes | outputBytes | sizeChangePercent | width | height | downloadUrl |
|---|---|---|---|---|---|---|---|---|
| https://example.com/photo.jpg | ok | webp | 2,481,733 | 412,904 | -83.4 | 1600 | 1067 | https://api.apify.com/v2/key-value-stores/.../records/0001-photo.webp |
| https://example.com/logo.png | ok | webp | 88,120 | 21,577 | -75.5 | 800 | 400 | https://api.apify.com/v2/key-value-stores/.../records/0002-logo.webp |
| https://example.com/missing.png | failed | | | | | | | *(error: The server answered HTTP 404 ...)* |

**Try it free:** leave the image list empty and press **Start** — 2 built-in sample images (a PNG with transparency and a JPG photo) are converted to WebP. Not charged; rows carry `_demo: true`.

### How to use

1. **Image URLs**: public links to JPG, PNG, WebP, GIF, BMP or TIFF images, one per line.
2. **Convert to**: WebP (default), JPG, PNG or AVIF.
3. Optional: **Quality** (1–100, default 85, used by JPG, WebP and AVIF), **Max width** / **Max height** in pixels, **Background color for JPG** (replaces transparency, default white).

```json
{
  "imageUrls": ["https://example.com/photo.jpg", "https://example.com/logo.png"],
  "outputFormat": "webp",
  "quality": 80,
  "maxWidth": 1200
}
```

### How the conversion works

- **Resize keeps the aspect ratio** and only shrinks: with max width 1200 a 4000×3000 photo becomes 1200×900, while a 800×600 image stays 800×600. Set both to fit a box.
- **Photo orientation** from the camera (EXIF) is applied, so portrait photos stay upright.
- **Metadata is removed**: EXIF data such as camera details and GPS location is not copied into the output file.
- **Animated GIFs and multi-page TIFFs**: the first frame or page is converted (`animated: true` in the row).
- **Transparency** is kept in PNG, WebP and AVIF; JPG has none, so transparent areas get the background color.

### Output fields

- `sourceUrl`, `status` (`ok` or `failed`), `error` (the reason when it failed)
- `fileName`, `downloadUrl` — the converted file in the run's key-value store
- `inputFormat`, `outputFormat`, `inputBytes`, `outputBytes`, `sizeChangePercent` (negative = smaller)
- `originalWidth`, `originalHeight`, `width`, `height`, `animated`

A **STATS** record sums up images converted, failed and charged and the options used. Download the rows as CSV, Excel or JSON from the run page.

### Limits (cannot be raised by input)

- 1,000 image URLs per run; 25 MB per input file; 50 megapixels per image (protection against "decompression bomb" files)
- WebP allows at most 16,383 pixels per side — set a max width or height for bigger images
- Public images only (no login); links to internal network addresses are blocked
- Set a maximum charge per run to cap spend: the run stops cleanly when it is reached and keeps the images converted so far

### Pricing

Pay per event: **$0.001 per converted image**, the same for a 20 KB icon and a 25 MB photo. Failed downloads, unreadable or oversized images and the demo are free.
Store discounts apply automatically: BRONZE −10%, SILVER −20%, GOLD −30%.
On the Apify Free plan, the $5 of monthly platform credit covers about 5,000 images a month.

### FAQ

**Is the quality loss visible?** At quality 80–90, JPG and WebP look the same as the original to most people while being much smaller. Use PNG for lossless output.

**Which format should I pick?** WebP for websites (small, supported by all current browsers), JPG for maximum compatibility, PNG for lossless graphics and screenshots, AVIF for the smallest files where it is supported.

**Can I convert HEIC or SVG?** Not at the moment. Supported inputs are JPG, PNG, WebP, GIF, BMP and TIFF.

**How long are the files kept?** As long as the run's storage is kept under your Apify plan's data retention. Download them or copy them to your own storage if you need them longer.

If this Actor saved you time, a rating on the Store helps others find it.

### More tools from the same developer

- [OCR Image to Text](https://apify.com/ucchiii/ocr-image-text) — OCR for image URLs and scanned PDFs with built-in Tesseract: text, confidence and line boxes in 8 languages
- [Website Screenshot](https://apify.com/ucchiii/website-screenshot) — screenshots and PDFs of web pages: full page, mobile, element, no cookie banners
- [Free Stock Photo Search](https://apify.com/ucchiii/stock-photos-openverse-search) — openly licensed images with license and ready-to-paste attribution

# Actor input Schema

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

Public http(s) links to JPG, PNG, WebP, GIF, BMP or TIFF images, one per line (up to 1,000 per run, 25 MB and 50 megapixels each). Leave empty for a free demo on 2 built-in sample images.

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

Output format. Transparent areas become the background color in JPG.

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

1-100. Default 85. Lower = smaller files. PNG is always lossless and ignores this.

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

Optional. Images wider than this are shrunk, keeping the aspect ratio. Smaller images are never enlarged.

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

Optional. Images taller than this are shrunk, keeping the aspect ratio. Use with max width to fit a box.

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

Hex color that replaces transparency when converting to JPG. Default #FFFFFF (white).

## Actor input object example

```json
{
  "imageUrls": [
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
  ],
  "outputFormat": "webp",
  "quality": 85,
  "background": "#FFFFFF"
}
```

# Actor output Schema

## `images` (type: `string`):

One row per image URL: download link, formats, file size before and after, width and height, or the reason it failed.

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

The key-value store that holds the converted image files.

## `stats` (type: `string`):

Record STATS: images converted, failed and charged, the options used and whether the run stopped early.

# 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/python-pillow/Pillow/main/Tests/images/hopper.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/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/python-pillow/Pillow/main/Tests/images/hopper.png"] }

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/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/python-pillow/Pillow/main/Tests/images/hopper.png"
  ]
}' |
apify call ucchiii/image-converter --silent --output-dataset

```

## MCP server setup

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