# Image Format Converter (`programmersoham/image-format-converter`) Actor

Convert images in the cloud between HEIC, WebP, JPG, PNG, and SVG. Strip EXIF metadata for privacy, resize with aspect-ratio preservation, and export via direct URLs or archives (ZIP, TAR.GZ, GZIP, 7-Zip). Ideal for HEIC conversion, SVG rasterization, and standardizing image collections.

- **URL**: https://apify.com/programmersoham/image-format-converter.md
- **Developed by:** [Soham Purohit](https://apify.com/programmersoham) (community)
- **Categories:** Automation, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 13 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

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

## Image Format Converter

Convert images between multiple formats with this powerful Apify Actor. Supports HEIC, WebP, JPG, PNG, and SVG with batch processing, metadata removal, resizing, and ZIP archive download.

### 🎯 Supported Conversions

| From | To |
|------|-----|
| **HEIC** | JPG, PNG |
| **WebP** | JPG, PNG |
| **JPG** | PNG |
| **PNG** | JPG |
| **SVG** | JPG, PNG |

### ✨ Features

- **🔄 Batch Processing**: Convert multiple images in a single run
- **🌐 URL Input**: Fetch images directly from URLs
- **🔒 Privacy Protection**: Remove EXIF, XMP, IPTC metadata (enabled by default)
- **📐 Resize Support**: Resize images while maintaining aspect ratio
- **📦 ZIP Download**: Get all converted images as a single ZIP archive
- **⚡ High Performance**: Uses libvips/sharp for blazing-fast processing
- **☁️ Cloud-Based**: No software installation required

### 📥 Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `imageUrls` | Array | `[]` | URLs of images to convert (HEIC, WebP, JPG, PNG, SVG) |
| `outputFormat` | String | `"jpg"` | Target format: `jpg` or `png` |
| `quality` | Integer | `90` | Output quality 1-100 (JPEG only) |
| `outputDelivery` | String | `"both"` | `urls`, `zip`, or `both` |
| `removeMetadata` | Boolean | `true` | Strip EXIF and other metadata for privacy |
| `resizeWidth` | Integer | - | Resize to this width (1-10000, proportional) |
| `resizeHeight` | Integer | - | Resize to this height (1-10000, proportional) |

### 📤 Example Input

#### Basic Conversion

```json
{
    "imageUrls": [
        "https://example.com/photo.heic",
        "https://example.com/image.webp"
    ],
    "outputFormat": "jpg",
    "quality": 90
}
```

#### With Resize and Privacy

```json
{
    "imageUrls": [
        "https://example.com/large-photo.jpg"
    ],
    "outputFormat": "png",
    "removeMetadata": true,
    "resizeWidth": 800
}
```

#### Download as ZIP Only

```json
{
    "imageUrls": [
        "https://example.com/img1.svg",
        "https://example.com/img2.svg"
    ],
    "outputFormat": "png",
    "outputDelivery": "zip"
}
```

### 📊 Output

#### Converted Images

- **Individual URLs**: Direct links to each converted image in key-value store
- **ZIP Archive**: All images bundled as `archive-converted-images.zip`

#### Dataset Entry Example

```json
{
    "originalUrl": "https://example.com/photo.heic",
    "originalFormat": "heic",
    "outputFormat": "jpg",
    "outputUrl": "https://api.apify.com/v2/key-value-stores/.../records/image-photo-1.jpg",
    "fileSize": 125432,
    "width": 1920,
    "height": 1080,
    "status": "success"
}
```

### 💡 Use Cases

- **Privacy**: Strip GPS coordinates and camera info from photos before sharing
- **Web Optimization**: Convert HEIC from iPhones to web-friendly JPG/PNG
- **Batch Resize**: Resize hundreds of images for thumbnails or social media
- **Format Standardization**: Convert mixed formats to a single standard
- **SVG Rasterization**: Convert vector graphics to high-quality raster images

### 🔌 API Integration

#### JavaScript/Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('YOUR_USERNAME/image-format-converter').call({
    imageUrls: ['https://example.com/photo.heic'],
    outputFormat: 'jpg',
    quality: 95,
    removeMetadata: true,
    resizeWidth: 1200
});

// Get results
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

run = client.actor("YOUR_USERNAME/image-format-converter").call(run_input={
    "imageUrls": ["https://example.com/photo.heic"],
    "outputFormat": "jpg",
    "quality": 95,
    "removeMetadata": True,
    "resizeWidth": 1200
})

## Get results
items = client.dataset(run["defaultDatasetId"]).list_items().items
print(items)
```

### 🔧 Technical Details

| Component | Technology |
|-----------|------------|
| Runtime | Node.js 24 (Alpine) |
| Language | TypeScript |
| Image Processing | sharp (libvips) |
| HEIC Support | heic-convert |
| ZIP Compression | archiver |

### 📄 License

ISC

# Actor input Schema

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

List of image URLs to convert. Supports HEIC, WebP, JPG, PNG, and SVG formats.

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

Target image format for conversion.

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

Quality of the output image (1-100). Only applies to JPEG output.

## `outputDelivery` (type: `string`):

How to deliver converted images. ZIP/archives are recommended for batch downloads.

## `removeMetadata` (type: `boolean`):

Remove EXIF and other metadata from output images for privacy.

## `resizeWidth` (type: `integer`):

Optional width to resize images to. Height will be scaled proportionally.

## `resizeHeight` (type: `integer`):

Optional height to resize images to. Width will be scaled proportionally.

## Actor input object example

```json
{
  "imageUrls": [
    "https://www.w3schools.com/css/img_5terre.jpg"
  ],
  "outputFormat": "jpg",
  "quality": 90,
  "outputDelivery": "zip",
  "removeMetadata": true
}
```

# Actor output Schema

## `convertedImages` (type: `string`):

No description

## `dataset` (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://www.w3schools.com/css/img_5terre.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("programmersoham/image-format-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://www.w3schools.com/css/img_5terre.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("programmersoham/image-format-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://www.w3schools.com/css/img_5terre.jpg"
  ]
}' |
apify call programmersoham/image-format-converter --silent --output-dataset

```

## MCP server setup

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