How to download all images from a website (and get them as a ZIP)
"Download all images" sounds simple until you meet modern pages: the visible image is a small srcset candidate, half the images are lazy-loaded with data-src, some are CSS backgrounds, and the page is full of icons and 1×1 tracking pixels. Here is what works.
1. One page, by hand
Browser extensions work for a single page you have open. They save what the browser loaded, so lazy images below the fold are often missing and you still get every icon.
2. A script
Fetch the HTML, collect image URLs from img, srcset, data-src, <picture> and og:image, resolve relative URLs, then download each one. The full code is in Python and JavaScript. Add size filtering (see icons and tracking pixels) and dedupe by file hash.
3. An API that returns a ZIP
If you need this repeatedly, for many pages, or from an app or an AI agent, call the hosted Website Image Downloader. It does the extraction, size filtering, deduplication and zipping for you:
curl -X POST "https://api.apify.com/v2/acts/sste~website-image-downloader/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
-d '{"startUrls":[{"url":"https://www.example.com/gallery"}],"minWidth":200,"minHeight":200}'
The response lists every image with width, height, format, bytes and alt; the files are in the run's images.zip. To cover a whole site section, add "crawlDepth": 1 or 2.
Checklist for complete results
- Take the largest srcset candidate, not
src. - Read lazy-load attributes and
<noscript>fallbacks. - Include CSS
background-imageandog:imagewhen relevant. - Filter by real pixel size, not by HTML
widthattributes. - Dedupe by content hash (CDNs serve the same file under many URLs).
- Respect copyright and site terms.