A simple lightweight library to download images (and other files)
Project description
Python Image Fetcher
A simple lightweight library to download images (and other files)
Install
With Python 3.5+ run:
pip install image-fetcher
Key features
- Speed: By using multi-threading, more images can be downloaded per second
- No download duplication: To avoid unnecessary downloads
- Progress bar: To track how your download is getting on
Usage
The simplest usage involves passing a list of URL's and the folder you want the images to be saved to:
from image_fetcher import multi_thread_image_download
multi_thread_image_download(
["https://benaandrew.github.io/images/sentiment.jpg","https://benaandrew.github.io/images/dog.jpg"],
"images",
)
If you have your URL's saved in a text file you can instead give the path to that file
multi_thread_image_download(
"urls.txt",
"images",
)
Additional arguments
- max_fetching_threads (int): Sets the maximum number of concurrent image downloads
- Increasing this increases download throughput but also uses more processing power and can cause errors when set too high
- By default is set the number of cpu cores x 5
- download_timeout (int): Seconds before a download is abandoned
- Increasing this means more time will be allowed per download. If every download is important you should set this high
- If set to None, download will only timeout if the connection does so
- The default is 5 seconds
- verbose (bool): Whether to show progress bar
- On by default
You can pass these like so:
multi_thread_image_download(
"urls.txt",
"images",
max_fetching_threads=5,
download_timeout=10,
verbose=False
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_fetcher-2.0.1.tar.gz.
File metadata
- Download URL: image_fetcher-2.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f7d91b94a251f355874bc15ed329638e3e5fbdd45b06c11f466d68c156d4a92
|
|
| MD5 |
0b0bd34d4642542c030952e39b8ede3d
|
|
| BLAKE2b-256 |
8190a150489be5499e164624bbbe0b4422635aac9f69e0607bcf1a2f5713260d
|
File details
Details for the file image_fetcher-2.0.1-py3-none-any.whl.
File metadata
- Download URL: image_fetcher-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33a40dfcf68619881f744401a4723fa321da97b7bb7f66e442f9ae154089833e
|
|
| MD5 |
68c00134d64e53ec0566853e09f8bcc4
|
|
| BLAKE2b-256 |
b015b7d2a414c12010bf93ce96b62c7154e4b1864c76e78bc63b9e2601385e80
|