# Bulk Image Downloader & Optimizer: URLs/Dataset to WebP/JPG+ZIP (`zubayer01/bulk-image-downloader-optimizer`) Actor

Download images in bulk from a list of URLs or any Apify dataset, then resize, convert to WebP, JPEG, PNG or AVIF, strip metadata, remove duplicates and get everything in ZIP files. Works as an integration after any scraper.

- **URL**: https://apify.com/zubayer01/bulk-image-downloader-optimizer.md
- **Developed by:** [Talha Zubayer](https://apify.com/zubayer01) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-usage

## 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

### What is Bulk Image Downloader & Optimizer?

**Bulk Image Downloader & Optimizer** downloads images in bulk from **a list of URLs** or from **any Apify dataset** (for example the results of a scraper), then **resizes** them, **converts** them to **WebP, JPEG, PNG or AVIF**, **removes hidden metadata** (GPS, camera data) and **skips duplicates**. You get every image as a single file plus **ZIP archives** you can download in one click, and a results table that shows the size of every image **before and after optimization**.

Paste some image links and click **Start**, or attach it to your scraper in the **Integrations** tab so that every scraper run ends with a ready-to-use folder of optimized images.

#### What can it do?

- 📥 **Download images in bulk** from URL lists or dataset fields (nested fields and lists supported, or automatic detection of image links)
- 🗜️ **Optimize**: convert to **WebP**, **AVIF**, **JPEG** or **PNG**, set the quality, resize to a maximum width/height (never enlarged)
- 🧹 **Clean**: strip EXIF/XMP/IPTC metadata (photos are rotated the right way up first)
- 🧬 **Deduplicate** by link and by SHA-256 fingerprint of the file
- 🏷️ **Name files your way**: `{index}`, `{originalName}`, `{hash8}` or any dataset field such as `{sku}` or `{title}`, with optional folders like `{brand}/{sku}`
- 📦 **ZIP archives** split at the size you choose (default 500 MB)
- 💸 **Fair pricing**: you pay only for images that were delivered; skipped and failed images are free
- 🔒 **Safe by design**: only http/https, private and internal network addresses are blocked
- 🔌 Runs on the Apify platform: **API**, **scheduling**, **integrations** (Make, Zapier, n8n, webhooks), monitoring and an **MCP** server for AI agents

### Who is it for?

- 🛒 **E-commerce** teams moving product photos from supplier catalogs or marketplaces into their own shop, with SKU-based file names
- 🏠 **Real estate** portals and agencies collecting listing photos, resized and without GPS data
- 🤖 **AI and machine-learning** projects building image datasets: consistent format, minimum size filter, duplicates removed, SHA-256 per file
- 📣 **Marketers and agencies** archiving creatives, logos and social media images
- 🕷️ **Anyone who scraped image URLs** with another Actor (Google Maps, Amazon, Instagram, Airbnb, e-commerce scrapers...) and now needs the actual files

### How to download images in bulk

1. Click **Try for free** (or **Start**) on this page.
2. Paste your image links into **Image URLs**, one per line, **or** pick a dataset in **Dataset with image URLs**.
3. Choose the **Output format** (WebP is a good default), and optionally a **Maximum width/height**.
4. Click **Start** and wait for the run to finish.
5. Download the ZIP from the **Output** tab, or use the direct link of each image in the results table.

### Input examples

You can fill in the form in Apify Console or send the input as JSON through the API.

#### Example 1: a list of image URLs

```json
{
    "imageUrls": [
        "https://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
        "https://images-assets.nasa.gov/image/as17-148-22727/as17-148-22727~medium.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
    ],
    "outputFormat": "webp",
    "quality": 80,
    "maxWidth": 1600,
    "createZip": true
}
```

#### Example 2: images from the dataset of another Actor

Use the ID of the dataset (Console → **Storage** → **Datasets**, or the **Storage** tab of the scraper run). This example takes the `images` and `thumbnail` fields of every product, names files by SKU and puts them into one folder per brand:

```json
{
    "datasetId": "YOUR_DATASET_ID",
    "imageFields": ["images", "thumbnail"],
    "itemIdFields": ["sku", "url"],
    "fileNameTemplate": "{sku}-{index}",
    "folderTemplate": "{brand}",
    "outputFormat": "jpeg",
    "quality": 85,
    "maxWidth": 1200,
    "minWidth": 200
}
```

Field paths can point into nested objects and lists: `images` (a list of links), `gallery.url` (a list of objects with `url`), `media[].src`, `photos[0]`. Leave **Image URL fields** empty and the Actor finds image links on its own. Relative links (`/img/a.jpg`) are resolved with the item's `url` field.

#### Example 3: run automatically after a scraper (Integrations tab)

1. Open the scraper Actor (or its saved task) in Apify Console and go to the **Integrations** tab.
2. Click **Add integration** (or **Connect Actor or task**) and search for **Bulk Image Downloader & Optimizer**.
3. Under **Start when**, choose **Run succeeded**.
4. In the input, set **Dataset with image URLs** to `{{resource.defaultDatasetId}}`, the dataset of the scraper run that just finished. Set **Image URL fields** if you know which fields hold the images, and choose your format and size.
5. Click **Save**, then use **Test integration** with a past run of the scraper.

The input of the integration then looks like this:

```json
{
    "datasetId": "{{resource.defaultDatasetId}}",
    "imageFields": ["images"],
    "outputFormat": "webp",
    "maxWidth": 1600
}
```

If you leave **Dataset with image URLs** empty, the Actor uses the dataset from the integration's run information (`payload.resource.defaultDatasetId`). The three sample images of the input form are ignored in integration runs, so you are never charged for them.

### Output

#### Results table (dataset)

Every input image gets one row, also when it was skipped or failed:

```json
{
    "index": 1,
    "status": "ok",
    "reason": null,
    "reasonCode": null,
    "sourceUrl": "https://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
    "fileKey": "image-00001-DP-42549-001.webp",
    "fileUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/image-00001-DP-42549-001.webp",
    "fileName": "00001-DP-42549-001.webp",
    "format": "webp",
    "width": 599,
    "height": 477,
    "bytesOriginal": 221383,
    "bytesFinal": 107460,
    "savedPercent": 51.5,
    "originalFormat": "jpeg",
    "originalWidth": 599,
    "originalHeight": 477,
    "sha256": "<sha256 of the original file>",
    "source": "imageUrls",
    "sourceItemIndex": null,
    "sourceField": null,
    "sourceItem": null
}
```

A skipped or failed row explains why, for example `"status": "failed", "reasonCode": "http-404", "reason": "HTTP 404 Not Found: there is no file at this address"` or `"status": "skipped", "reasonCode": "duplicate", "reason": "Same image as #3 (image-00003-red-shoe.webp)"`. For dataset input, `sourceItem` holds identifying fields of the item (for example `sku` and `url`), so you can match images back to products. You can export the table as JSON, CSV, Excel or HTML.

#### Files and ZIP archives (key-value store)

- **Images**: one record per saved image, keys starting with `image-` (for example `image-00001-red-shoe.webp`).
- **ZIP files**: `archive-001.zip`, `archive-002.zip`, ... with all saved images (and folders, if you set a folder template).
- **OUTPUT**: a summary of the run:

```json
{
    "status": "completed",
    "message": "Done. 280 saved, 12 skipped, 8 failed. Size: 96.4 MB → 31.2 MB (67.6% smaller). ZIP: 1 file(s).",
    "images": { "processed": 300, "saved": 280, "skipped": 12, "failed": 8, "charged": 280 },
    "skippedReasons": { "duplicate": 9, "too-small": 3 },
    "failedReasons": { "http-404": 6, "timeout": 2 },
    "bytesOriginal": 101083136,
    "bytesFinal": 32715571,
    "bytesSaved": 68367565,
    "savedPercent": 67.6,
    "zipFiles": [
        { "key": "archive-001.zip", "url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/archive-001.zip", "files": 280, "bytes": 32760000 }
    ],
    "maxCostReached": false
}
```

The **Output** tab of the run shows the results table, the ZIP files, the single images and this summary.

### How much does it cost to download and optimize images?

This Actor uses **pay per event** pricing, so the cost is easy to predict:

- **Image delivered** (`image-delivered`): charged once for every image that was saved (status `ok`). The exact price is on the **Pricing** tab.
- **Actor start** (`apify-actor-start`): a tiny fixed fee per run set by Apify ($0.00005 per run at up to 1 GB of memory).
- **Free**: duplicates, images that are too small or too large, broken links and every other skipped or failed image.

**Worked example** at $2.00 per 1,000 delivered images ($0.002 per image): you send 2,500 image links; 120 are duplicates, 40 are smaller than your minimum size and 90 are broken links. The Actor delivers 2,500 − 120 − 40 − 90 = **2,250 images**, so the run costs 2,250 × $0.002 + $0.00005 ≈ **$4.50**. The 250 skipped and failed images cost nothing.

**Maximum cost per run**: set **Maximum cost per run** when you start the Actor (Console run options or `maxTotalChargeUsd` in the API) and the Actor stops gracefully before going over it. It finishes the images in progress, closes the ZIP file, writes the summary with `"status": "stopped-max-cost"`, and says so in the log. Start again with a higher limit to process the rest.

### Limits

- **Formats in**: JPEG, PNG, WebP, GIF (also animated), AVIF, SVG, BMP (uncompressed) and TIFF. HEIC, ICO, JPEG XL and PDF are not supported.
- **Formats out**: original, WebP, JPEG, PNG or AVIF. SVG files and animated GIFs keep their original format unless you choose a format; animated images stay animated as WebP.
- **File size**: up to 25 MB per file by default, configurable up to 100 MB.
- **Image size**: up to about 40 megapixels with 512 MB of memory and 80 megapixels with 1 GB (the default). Bigger images are skipped with a clear reason.
- **ZIP files**: split at 500 MB by default (10–2,000 MB). With 512 MB of memory, ZIP files are at most 409 MB because of disk space.
- **Memory**: 512 MB to 1 GB. The Actor streams files through disk, so memory use does not grow with the number of images.
- **Links**: only `http://` and `https://`. Links to private or internal network addresses, and links with a username or password, are refused.
- **No logins**: the Actor does not send cookies or passwords, so images behind a login or paywall cannot be downloaded.
- **Order**: images are downloaded in parallel, so rows may arrive in a different order; the `index` column keeps the input order.

### FAQ

#### Will I pay for images that failed or were skipped?

No. Only images with status `ok` are charged. Duplicates, too small or too large images, broken links, blocked links and other errors are free, and each of them has a `reason` in the results.

#### Why was an image skipped or why did it fail?

Look at the `reason` and `reasonCode` columns. Common cases: `http-404` (the link is broken), `http-403` (the website refuses downloads), `timeout` (the server was too slow; increase **Download timeout**), `not-an-image` (the link points to a web page, not an image), `duplicate`, `too-small` (below **Minimum width/height**) and `too-large` (above **Maximum file size**).

#### How do I download all images at once?

Open the **Output** tab of the run and download the ZIP file, or use `zipFiles[].url` from the `OUTPUT` record. Each image also has its own link in the `fileUrl` column.

#### Can I keep the original files without any change?

Yes. Set **Output format** to **Original**, leave the maximum width and height empty and turn off **Remove metadata**. Files are then saved byte for byte as downloaded.

#### Why is an SVG file bigger after conversion?

SVG is a vector format: a small text file that can be drawn at any size. Converting it to WebP, JPEG, PNG or AVIF turns it into pixels, which usually makes it bigger. Keep **Original** format to leave SVG files unchanged.

#### Some website blocks the downloads. What can I do?

Lower **Parallel downloads** (for example to 2 or 3) and raise **Retries per image**. Some websites refuse all automated downloads; those images are reported as failed and not charged.

#### Can I use it through the API or from an AI agent?

Yes. Start it with the [Apify API](https://docs.apify.com/api/v2), the Apify JavaScript or Python client, Make, Zapier or n8n, or from AI agents through the [Apify MCP server](https://docs.apify.com/mcp). The input and output are fully described, so agents can chain it after any scraper.

#### Does it work with images from Google Maps, Amazon, Instagram or other scrapers?

Yes. Use the scraper's dataset as input and set **Image URL fields** to the field that holds the images (for example `imageUrls`, `images`, `thumbnailUrl` or `displayUrl`), or leave it empty to detect image links automatically.

### Responsible use

- Download only images that you have the **right to download and use**: your own images, images you have permission or a license for, or images in the public domain. Respect copyright, trademarks and the terms of the websites you download from.
- Do not use this Actor for **private or login-protected content**. It does not log in anywhere and is not meant to access content that is not publicly available.
- Photos of people can be personal data. If you collect them, make sure you have a legal basis and follow privacy laws such as the GDPR.
- Keep the load on websites reasonable: use moderate **Parallel downloads** for small websites.

The sample images in the input form are in the public domain or CC0: *Wheat Field with Cypresses* by Vincent van Gogh (The Metropolitan Museum of Art, Open Access, CC0), *The Blue Marble* (NASA, Apollo 17, public domain) and *Example.svg* (Wikimedia Commons, public domain).

### Support

Found a bug or need a feature? Open an issue on the **Issues** tab and include the run ID; we usually reply within a few days.

# Changelog

This Actor's version history is a separate document: https://apify.com/zubayer01/bulk-image-downloader-optimizer/changelog.md

# Actor input Schema

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

Direct links to the images you want to download, one per line (http or https only). Leave empty if you only want to use a dataset below. Example: https://example.com/photos/red-shoe.jpg

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

Pick a dataset from your Apify account, for example the results of a scraper run. The Actor reads every item and downloads the images it finds (see "Image URL fields"). Only read access to this one dataset is requested. When this Actor runs as an integration after another Actor, you can leave this empty: the dataset of the run that triggered it is used automatically.

## `imageFields` (type: `array`):

Names of the dataset fields that contain image links. Use dots for nested fields; lists are searched automatically. Examples: "image", "images", "gallery.url", "media\[].src", "photos\[0]". Leave empty to detect image links in every field automatically.

## `itemIdFields` (type: `array`):

Dataset fields copied into every result row under "sourceItem", so you can match each image back to its product or listing (for example "sku", "id", "url"). Leave empty to copy these fields automatically when they exist: id, sku, productId, asin, code, handle, url, title.

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

Stop after this many images (duplicates and failures count too). Useful to try the Actor on a sample of a big dataset. Leave empty for no limit.

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

File format of the saved images. "Original" keeps each file's own format and re-encodes it only when it has to be resized or its metadata removed. WebP gives small files that work in every modern browser; AVIF is even smaller but slower to create. SVG files and animated GIFs are converted only when you pick a format here; with "Original" they are kept unchanged. Animated images stay animated when converted to WebP.

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

Compression quality for JPEG, WebP and AVIF, from 1 (smallest file) to 100 (best quality). 75-85 is a good balance for websites and shops. PNG is always lossless and ignores this setting.

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

Shrink images that are wider than this, keeping their proportions. Images are never enlarged. Leave empty to keep the original width.

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

Shrink images that are taller than this, keeping their proportions. Images are never enlarged. Leave empty to keep the original height.

## `stripMetadata` (type: `boolean`):

Remove hidden data such as GPS location, camera model and editing history (EXIF, XMP, IPTC). Photos are rotated the right way up before the data is removed. Turn off to keep the metadata, for example for photo archives.

## `minWidth` (type: `integer`):

Skip images narrower than this, such as icons, tracking pixels and tiny thumbnails. Skipped images are not charged. 0 = no minimum.

## `minHeight` (type: `integer`):

Skip images shorter than this. Skipped images are not charged. 0 = no minimum.

## `deduplicate` (type: `boolean`):

Skip an image when the same link appeared earlier in the run, or when its file is identical to an image already saved (compared by the SHA-256 fingerprint of the downloaded bytes). Duplicates are not charged.

## `fileNameTemplate` (type: `string`):

How saved files are named; the extension is added automatically. Placeholders: {index} = position of the image in the input (00001, 00002, ...), {originalName} = file name from the link without extension, {hash8} = first 8 characters of the file's SHA-256 fingerprint, and any dataset field such as {sku} or {title} (use dots for nested fields, e.g. {product.sku}). Characters other than letters, digits, dot, dash and underscore become dashes. When two files get the same name, -2, -3 ... is added.

## `folderTemplate` (type: `string`):

Optional folders inside the ZIP file, using the same placeholders as the file name, for example {brand} or {category}/{sku}. Leave empty for no folders. In the key-value store the folder becomes part of the file key (slashes become underscores).

## `createZip` (type: `boolean`):

Also pack all saved images into ZIP files that you can download in one click. Single files are always saved as well.

## `zipMaxSizeMb` (type: `integer`):

Start a new ZIP file (archive-002.zip, ...) when the current one would get bigger than this. With 512 MB of Actor memory, ZIP files are limited to 409 MB because of disk space.

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

How many images are downloaded at the same time. Lower it if a website limits fast downloads; raise it for many small images from fast servers.

## `maxRetries` (type: `integer`):

How many times a download is tried again, with growing pauses, when the error looks temporary (timeout, connection error, HTTP 429 or 5xx). Permanent errors such as 404 Not Found are not retried.

## `requestTimeoutSecs` (type: `integer`):

Give up one download attempt after this many seconds.

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

Skip files larger than this. Protects the run from huge files. Skipped images are not charged.

## Actor input object example

```json
{
  "imageUrls": [
    "https://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
    "https://images-assets.nasa.gov/image/as17-148-22727/as17-148-22727~medium.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
  ],
  "outputFormat": "webp",
  "quality": 82,
  "stripMetadata": true,
  "minWidth": 0,
  "minHeight": 0,
  "deduplicate": true,
  "fileNameTemplate": "{index}-{originalName}",
  "createZip": true,
  "zipMaxSizeMb": 500,
  "concurrency": 10,
  "maxRetries": 3,
  "requestTimeoutSecs": 30,
  "maxFileSizeMb": 25
}
```

# Actor output Schema

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

One row per input image: status (ok, skipped, failed), reason, file link, dimensions, format and size before and after optimization.

## `zipFiles` (type: `string`):

All saved images packed into ZIP files (archive-001.zip, ...), ready to download in one click.

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

Every saved image as a single file in the key-value store (keys start with image-).

## `summary` (type: `string`):

JSON summary: number of saved, skipped and failed images, bytes saved, charged images and ZIP links.

# 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://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
        "https://images-assets.nasa.gov/image/as17-148-22727/as17-148-22727~medium.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
    ],
    "outputFormat": "webp"
};

// Run the Actor and wait for it to finish
const run = await client.actor("zubayer01/bulk-image-downloader-optimizer").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://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
        "https://images-assets.nasa.gov/image/as17-148-22727/as17-148-22727~medium.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg",
    ],
    "outputFormat": "webp",
}

# Run the Actor and wait for it to finish
run = client.actor("zubayer01/bulk-image-downloader-optimizer").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://images.metmuseum.org/CRDImages/ep/web-large/DP-42549-001.jpg",
    "https://images-assets.nasa.gov/image/as17-148-22727/as17-148-22727~medium.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg"
  ],
  "outputFormat": "webp"
}' |
apify call zubayer01/bulk-image-downloader-optimizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zubayer01/bulk-image-downloader-optimizer"
        }
    }
}
```

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/dvmqjXtgy6RfMaCFz/builds/tfkreefbUQiFAQSBM/openapi.json
