# How to download every image from a list of web pages or a scraper dataset (and convert to WebP)

> Source: <https://dev.to/rel8ble/how-to-download-every-image-from-a-list-of-web-pages-or-a-scraper-dataset-and-convert-to-webp-1e3c>
> Published: 2026-12-04 18:36:16+00:00

**Key takeaway:** The actor sniffs image bytes to detect real formats, filters by a 100-300px minWidth and dedupes by SHA-256, and converting to WebP at a 1,200px max width cut a 24.9 MB test set to 3.8 MB.

You scraped 2,000 products and every row has an `images` array of URLs. Now you need the actual files: resized, in WebP, with stable names, for a Shopify import, a product feed or an ML dataset. Or you just want every image on a list of pages. Here is what makes bulk image downloading less painful.

`<img src>` alone misses most of them. Real pages use lazy-load attributes (`data-src`, `data-srcset`, `data-lazy-src`), `srcset` (take the largest candidate), `<picture>` sources, `og:image`, and JSON-LD `image` / `logo`. Read all of those.

`photo.jpg?w=800` is often a WebP. `/image/12345` has no extension at all. Sniff the first bytes to know what you really got before you convert or name the file.

A `minWidth` of 100-300 px removes tracking pixels, icons and spacer GIFs. Hashing the content (SHA-256) removes the same photo served under five CDN URLs.

A max width of 1,200 px in WebP is usually 5-10x smaller than the original JPEG, and good enough for a store. Do it in the same pass, not as a second job.

Real rows from a 3-image test run:

| Format | Width | Height | Bytes | File key | 
|---|---|---|---|---|
| jpeg | 500 | 333 | 22,803 | a210b3bb607a54f5.jpg | 
| png | 500 | 375 | 120,581 | aaa6a61e05d96ae7.png | 
| jpeg | 500 | 225 | 39,881 | 90934bfa02aad642.jpg | 

Local tests: 50 catalogue pages of books.toscrape.com gave 1,000 of 1,000 covers in 4.5 s; 20 pages plus 2 Wikipedia articles and a docs site, converted to WebP at max width 400, went from 24.9 MB in to 3.8 MB out. Each row also has `fileUrl` (a signed link that opens without a token), `sha256`, `pageUrl`, `altText`, `foundIn` (`img`, `meta`, `json-ld`, `picture` ...) and `status`.

I use my [Bulk Image Downloader](https://apify.com/rel8ble/bulk-image-downloader) ($0.50 per 1,000 saved images, resize and conversion included, no start fee; failed, filtered and duplicate images are free). It takes image URLs, web page URLs, or the dataset ID of another scraper's run. Product photos from a scraper's dataset:

```
{
  "datasetId": "YOUR_DATASET_ID",
  "datasetFields": ["images", "variants.*.image"],
  "outputFormat": "webp",
  "maxWidth": 1200,
  "minWidth": 200,
  "keyValueStoreName": "product-photos",
  "fileNaming": "original"
}
```

All JPEG/PNG images at least 300 px wide on a list of pages, from Python:

``` python
# pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("rel8ble/bulk-image-downloader").call(run_input={
    "pageUrls": [
        "https://books.toscrape.com/catalogue/page-1.html",
        "https://books.toscrape.com/catalogue/page-2.html"
    ],
    "allowedTypes": ["jpeg", "png"],
    "minWidth": 300
})
for img in client.dataset(run["defaultDatasetId"]).iterate_items():
    if img["status"] == "saved":
        print(img["width"], img["height"], img["fileUrl"])
```

With a named key-value store, re-running on the same pages only downloads (and charges) new image URLs, which makes it a cheap scheduled monitor.

Limits: plain HTTP, no JavaScript rendering, so infinite-scroll galleries need a browser scraper first; pass its dataset here. Only download images you have the right to copy.

**Using Claude, Cursor or another MCP client?** Add `https://mcp.apify.com?tools=rel8ble/bulk-image-downloader` as a remote MCP server and ask in plain English.

*Disclosure: I built and maintain this actor; it is a paid Apify actor (pay per result, Apify's free plan credit covers small tests). The sample rows above are real output from test runs.*
