# Bulk Image Downloader & Converter (WebP, JPG, PNG, AVIF, ZIP) (`squarish_altruism/image-downloader`) Actor

Download all images from web pages or a list of image URLs, convert to WebP/JPG/PNG/AVIF, resize, strip metadata, remove duplicates and get one ZIP. Pay per saved image.

- **URL**: https://apify.com/squarish_altruism/image-downloader.md
- **Developed by:** [John Joseph Wheatley](https://apify.com/squarish_altruism) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 image saveds

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 Downloader & Converter (WebP, JPG, PNG, AVIF + ZIP)

Download every image from a list of web pages, or from a list of direct image links. You can also convert, resize and clean them in the same run. You get **one ZIP file** plus a table with a preview, the original URL, the size and the alt text of each image.

- **Find images on pages automatically,** from `img`, `srcset` (always the largest version), `picture`, lazy-loading attributes, Open Graph and Twitter images, and links to image files.
- **Convert** to WebP, JPEG, PNG or AVIF, or keep the original files untouched.
- **Resize** to a maximum width and/or height. Images are never enlarged.
- **Strip metadata** such as camera details and GPS location.
- **Skip small images** like icons, tracking pixels and thumbnails, using a minimum width or height.
- **Remove duplicates,** whether they share a URL or have identical file contents.
- **Bundle everything as a ZIP,** split into 100 MB parts for very large runs.

### Use cases

- **E-commerce:** collect product photos from your own store or supplier pages, then convert them to WebP for faster pages.
- **Website migrations:** download every image from an old site before a redesign.
- **Marketing:** bulk-resize and compress image libraries for social media or newsletters.
- **AI and ML datasets:** gather images from pages you have the right to use.
- **Archiving:** keep a copy of the visual content of pages you manage.

### Input

```json
{
  "sources": [
    { "url": "https://example.com/products/summer-dress" },
    { "url": "https://cdn.example.com/photos/hero.jpg" }
  ],
  "format": "webp",
  "quality": 82,
  "maxWidth": 1600,
  "minWidth": 200,
  "stripMetadata": true,
  "createZip": true
}
```

### Output

One row per saved image:

```json
{
  "imageUrl": "https://example.com/img/hero-1600.jpg",
  "sourcePage": "https://example.com/products/summer-dress",
  "alt": "Blue summer dress",
  "url": "https://api.apify.com/v2/key-value-stores/…/records/00001-hero-1600-3ee1dd.webp",
  "format": "webp",
  "width": 1600,
  "height": 1067,
  "bytes": 98213,
  "originalFormat": "jpeg",
  "originalBytes": 412880
}
```

The ZIP link (or links, for very large runs) is in the run's `OUTPUT` record and the final status message.

### Pricing

**$0.001 per saved image**, which is $1 per 1,000 images.

These are free:

- skipped small images
- duplicates
- failed downloads
- pages you scan

### Notes

- **Static HTML only:** images that only appear after JavaScript runs, or behind a login, aren't found. Pass their direct URLs instead.
- **Your rights to the images:** only download images you have the right to use, and respect each site's terms and copyright.
- **Formats:** SVG files are kept as SVG unless you choose a conversion format. Animated GIFs stay animated when you keep the original or convert to WebP or GIF.

### Use with AI agents (MCP)

This Actor works as a tool for AI assistants such as Claude, ChatGPT and Cursor, through [Apify's MCP server](https://mcp.apify.com).

1. Add the server to your MCP client, with this Actor selected:

```json
{
  "mcpServers": {
    "apify": { "url": "https://mcp.apify.com?tools=squarish_altruism/image-downloader" }
  }
}
```

In Claude Code: `claude mcp add apify "https://mcp.apify.com?tools=squarish_altruism/image-downloader" -t http`

2. Sign in with your Apify account when your client asks. If it can't use OAuth, send your Apify API token in an `Authorization: Bearer` header.
3. Ask in plain language, for example: *"Download all images from https://example.com/gallery, convert them to WebP at most 1600 px wide, and give me the ZIP link."*

Runs started by an agent are billed to your Apify account at the same prices as above.

# Actor input Schema

## `sources` (type: `array`):

Direct image links, and/or web pages to collect all images from (img, srcset, picture, Open Graph image and linked image files).

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

Keep the original files, or convert every image.

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

1-100 for JPEG, WebP and AVIF.

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

Shrink larger images to fit this width (never enlarges). Leave empty to keep the size.

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

Shrink larger images to fit this height (never enlarges).

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

Remove EXIF data such as camera details and GPS location (images are re-encoded).

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

Ignore icons, tracking pixels and thumbnails. Skipped images are not charged.

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

Ignore images below this height. Skipped images are not charged.

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

Bundle all saved images into a ZIP file (split into 100 MB parts for very large runs).

## `maxImagesPerPage` (type: `integer`):

Maximum images collected from each page URL.

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

Maximum images processed (and paid for) in one run.

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

Larger files are skipped and not charged.

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

Images downloaded in parallel.

## Actor input object example

```json
{
  "sources": [
    {
      "url": "https://crawlee.dev/"
    }
  ],
  "format": "original",
  "quality": 82,
  "stripMetadata": false,
  "minWidth": 0,
  "minHeight": 0,
  "createZip": true,
  "maxImagesPerPage": 100,
  "maxImages": 1000,
  "maxFileSizeMb": 25,
  "maxConcurrency": 8
}
```

# Actor output Schema

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

One item per saved image.

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

Files saved to the run's default key-value store.

# 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 = {
    "sources": [
        {
            "url": "https://crawlee.dev/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("squarish_altruism/image-downloader").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 = { "sources": [{ "url": "https://crawlee.dev/" }] }

# Run the Actor and wait for it to finish
run = client.actor("squarish_altruism/image-downloader").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 '{
  "sources": [
    {
      "url": "https://crawlee.dev/"
    }
  ]
}' |
apify call squarish_altruism/image-downloader --silent --output-dataset

```

## MCP server setup

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

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/wwjp8uiCec9eG2BsL/builds/6Jps2DdTpGk5Yan2a/openapi.json
