Automating Image Downloads with Python: How I Downloaded 10,000 Bufficorn NFTs for ETHDenver 2025
As part of my preparations for ETHDenver 2025, I’m creating Bufficorn-themed visual art! I faced a challenge: downloading 10,000 Bufficorn NFT images quickly and efficiently.
Manually downloading these files would have been time-consuming, so I created a simple Python script to automate the process. This blog post walks you through the solution, step by step, so you can use it for your own projects on a Mac.
The Challenge
https://prod-metadata.s3.amazonaws.com/images/1.png
https://prod-metadata.s3.amazonaws.com/images/2.png
...
https://prod-metadata.s3.amazonaws.com/images/10000.png
Step-by-Step Guide
1. Open the Terminal
On your Mac, open the Terminal by pressing Command + Space
, typing Terminal
, and pressing Enter
.
2. Check if Python is Installed
Run the following command in the terminal to check if Python 3 is installed:
python3 --version
If Python is not installed, use Homebrew to install it:
brew install python
3. Install Required Libraries
Install the requests
library, which is necessary for downloading files:
python3 -m pip install requests
4. Create a Project Directory
In the terminal, create a new directory for your project and navigate to it:
cd ~/Downloads mkdir bufficorn_images && cd bufficorn_images
5. Write the Python Script
Create a Python file to hold the script:
nano download_images.py
Paste the following code into the file:
import os import requests # Directory to save images download_dir = "images" os.makedirs(download_dir, exist_ok=True) # Base URL and range of image numbers base_url = "https://prod-metadata.s3.amazonaws.com/images/" start = 1 end = 10000 # Loop through and download images for i in range(start, end + 1): image_url = f"{base_url}{i}.png" file_name = os.path.join(download_dir, f"{i}.png") try: response = requests.get(image_url, stream=True) if response.status_code == 200: with open(file_name, "wb") as file: for chunk in response.iter_content(chunk_size=8192): file.write(chunk) print(f"Downloaded: {file_name}") else: print(f"Failed to download {image_url}: HTTP {response.status_code}") except Exception as e: print(f"Error downloading {image_url}: {e}") print("Download complete.")
6. Run the Script
Run the script to start downloading the images:
python3 download_images.py
7. Verify the Download
Navigate to the images
folder to confirm all files were downloaded:
open images
Conclusion
This Python script made downloading 10,000 Bufficorn NFT images effortless, saving me countless hours. Whether you’re working on a similar project or exploring Python for automation, I hope this guide helps you unlock new productivity superpowers. ETHDenver 2025 is shaping up to be an incredible event, and I’m excited to showcase my Bufficorn-themed visuals. Stay tuned for more updates!
Stay tuned for the next post:
Using an RTX 4090 GPU to Remove Backgrounds from 10,000 Bufficorn NFTs!
Happy coding!
— Wiggles
wiggles@ethdenver.com