```
Can we create a script that will download all the images of a certain type (like .jpg) from a known directory, following a sequential naming order (like image_0001.jpg to image_2200.jpg)? This can be run from a command line in python, saving to the current directory.
```
A small Python script using `requests` can iterate the numeric range, build each filename, and download whatever exists into the current directory.
# Image Download Python script
Save this as `download_images.py`:
```python
import os
import requests
# ---- CONFIGURE THESE VALUES ----
BASE_URL = "https://example.com/path/to/images" # no trailing slash
BASENAME = "image_" # prefix before number
EXT = ".jpg" # file extension
START = 1 # first index (inclusive)
END = 2200 # last index (inclusive)
PAD = 4 # zero-padding width, e.g. 4 -> 0001
TIMEOUT = 10 # seconds
# --------------------------------
def main():
session = requests.Session()
for i in range(START, END + 1):
filename = f"{BASENAME}{i:0{PAD}d}{EXT}"
url = f"{BASE_URL}/{filename}"
print(f"Downloading {url} ...")
try:
resp = session.get(url, timeout=TIMEOUT)
except requests.RequestException as e:
print(f" Error fetching {url}: {e}")
continue
if resp.status_code == 200:
# Save to current directory
with open(filename, "wb") as f:
f.write(resp.content)
print(f" Saved as {filename}")
else:
print(f" Skipped (HTTP {resp.status_code})")
if __name__ == "__main__":
main()
```
## How to run it
1. Install `requests` once:
```bash
pip install requests
```
2. Edit the config block at the top:
- Set `BASE_URL` to the directory URL (without trailing slash).
- Set `BASENAME`, `EXT`, `START`, `END`, and `PAD` to match your pattern.
3. Run from the directory where you want the images saved:
```bash
python download_images.py
```
The script will attempt every URL from `image_0001.jpg` to `image_2200.jpg`, save 200-status responses as files in the current directory, and skip missing ones.
---
```
Can we build in a delay timer, so the requests for each image happen every certain number of seconds?
```
Yes. Add a configurable `DELAY` and `time.sleep(DELAY)` at the end of each loop iteration so each request is spaced out.
## Script with delay between downloads
Save this as `download_images.py`:
```python
import os
import time
import requests
# ---- CONFIGURE THESE VALUES ----
BASE_URL = "https://example.com/path/to/images" # no trailing slash
BASENAME = "image_" # prefix before number
EXT = ".jpg" # file extension
START = 1 # first index (inclusive)
END = 2200 # last index (inclusive)
PAD = 4 # zero-padding width, e.g. 4 -> 0001
TIMEOUT = 10 # seconds for each HTTP request
DELAY = 2.0 # seconds to wait between downloads
# ---------------------------------
def main():
session = requests.Session()
for i in range(START, END + 1):
filename = f"{BASENAME}{i:0{PAD}d}{EXT}"
url = f"{BASE_URL}/{filename}"
print(f"Downloading {url} ...")
try:
resp = session.get(url, timeout=TIMEOUT)
except requests.RequestException as e:
print(f" Error fetching {url}: {e}")
else:
if resp.status_code == 200:
with open(filename, "wb") as f:
f.write(resp.content)
print(f" Saved as {filename}")
else:
print(f" Skipped (HTTP {resp.status_code})")
# wait before the next request
time.sleep(DELAY)
if __name__ == "__main__":
main()
```
- Set `DELAY` to any float (e.g. `0.5` for half a second, `5.0` for five seconds) to throttle how often requests are made.[](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)
---
# Original question:
```
is there a chrome extension that can cycle through and save all the sequentially numbered images in a certain web directory?
```
Yes, there are Chrome extensions that can bulk-download images from a directory-like page and effectively handle sequentially numbered files, though most do this by scanning the page rather than “guessing” the next URL.
## Extensions to try
- **ImageAssistant – Batch Image Downloader**
This extension parses the current page, lists all detected images, and lets you filter by size, type, and URL patterns, then download selected ones in bulk.youtube
If your directory page actually lists `image001.jpg`, `image002.jpg`, etc. as links or thumbnails, ImageAssistant can grab them all at once and save them in a batch.youtube
- **Bulk Image Downloader** (Chrome extension, not the separate Windows app)
A simple bulk image download extension that can pull many images from the current page or multiple tabs in one click, with filters by resolution and file type.[chromewebstore.google](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)
This works well if the directory exposes the images directly on the page (as links or embedded images) rather than requiring manually changing the URL.[chromewebstore.google](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)
- **Generic “Image Downloader” extensions**
Several “Image Downloader”–style extensions allow:
- Selecting all images on the page.[tomfroese](https://www.tomfroese.com/blog/how-to-automatically-download-every-image-from-a-webpage)
- Renaming output with a base name plus an auto-incremented sequence (e.g. `file_01`, `file_02`, …), which gives you sequential filenames even if the original URLs are not numbered.[tomfroese](https://www.tomfroese.com/blog/how-to-automatically-download-every-image-from-a-webpage)
## Important limitation
- Almost none of these will **programmatically iterate missing URLs** (e.g. generate `/img001.jpg` … `/img500.jpg` when only `/img001.jpg` is visible). They typically:
- Scan whatever the page actually loads and shows.youtube
- Let you filter by URL substring, so you can select only URLs matching `img0` or a specific path, then download them in bulk.youtube
## If the directory really is “raw”
If you are looking at a bare directory index (e.g. Apache/nginx listing) that displays links for each file, then:
- Any of the bulk image downloaders above should be enough, since the images are already listed.[chromewebstore.google](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)youtube
- You can filter them by pattern and download everything in one go, which effectively “cycles” through all sequential filenames without you doing it manually.[chromewebstore.google](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)youtube
If you need true URL generation (e.g. 0001–1000 when they are _not_ listed), a short script (Python, shell, or a userscript) will generally be more reliable than a stock extension.
1. [https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en](https://chromewebstore.google.com/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji?hl=en)
2. [https://www.reddit.com/r/chrome/comments/k3vvyz/an_extension_to_save_all_images_in_tabs_in_the/](https://www.reddit.com/r/chrome/comments/k3vvyz/an_extension_to_save_all_images_in_tabs_in_the/)
3. [https://github.com/iqnivek/save_tabbed_images/issues/43](https://github.com/iqnivek/save_tabbed_images/issues/43)
4. [https://www.tomfroese.com/blog/how-to-automatically-download-every-image-from-a-webpage](https://www.tomfroese.com/blog/how-to-automatically-download-every-image-from-a-webpage)
5. [https://stackoverflow.com/questions/66028913/how-to-loop-sequentially-through-images-in-one-folder-and-compare-with-the-lates](https://stackoverflow.com/questions/66028913/how-to-loop-sequentially-through-images-in-one-folder-and-compare-with-the-lates)
6. [https://brian.carnell.com/articles/2020/using-the-chrome-single-file-extension-to-automatically-archive-every-web-page/](https://brian.carnell.com/articles/2020/using-the-chrome-single-file-extension-to-automatically-archive-every-web-page/)
7. [https://www.youtube.com/watch?v=0vwRPDqrRTw](https://www.youtube.com/watch?v=0vwRPDqrRTw)
8. [https://stackoverflow.com/questions/7699313/automatically-cycle-through-web-pages](https://stackoverflow.com/questions/7699313/automatically-cycle-through-web-pages)
9. [https://www.youtube.com/watch?v=OxQ-wvrb01k](https://www.youtube.com/watch?v=OxQ-wvrb01k)
10. [https://chromewebstore.google.com/detail/save-my-tabs/djadfifncobffjpicnkiegahdiobpaap?hl=en](https://chromewebstore.google.com/detail/save-my-tabs/djadfifncobffjpicnkiegahdiobpaap?hl=en)