A Python tool that downloads images from URLs, resizes them to 600x600 pixels with a white background, and automatically hosts them on GitHub.
- Add image URLs to the
images.csvfile - Run the script
- Each image is downloaded, resized, and uploaded to GitHub
- The new public URLs are saved in
processed_images.csv
- Resizes images to 600x600 pixels while preserving the original aspect ratio
- Automatic white background (including transparent PNG images)
- Output format: WebP (maximum quality, optimized for the web)
- Free hosting via GitHub (direct public URLs)
- Skips images already present in
processed_images.csv
- Python 3.x
- A GitHub account with a Personal Access Token (scope:
repo)
pip install requests PillowSet your GitHub token as an environment variable:
export GITHUB_TOKEN=your_github_tokenimage_url
https://example.com/image1.jpg
https://example.com/image2.pngIf the URL contains a comma in the filename, wrap it in quotes:
"https://example.com/image,name.webp"
python image_resizer.py images.csvResized image URLs are available in processed_images.csv:
image_url,resized_image_url
https://example.com/image1.jpg,https://raw.githubusercontent.com/.../
├── image_resizer.py # Main script
├── check_urls.py # Checks accessibility of generated URLs
├── cleanup_csv.py # Removes duplicates and invalid CSV entries
├── verify_images.py # Verifies image dimensions and background color
├── push_to_github.py # Exports source code to GitHub
├── images.csv # Source URLs to process
├── processed_images.csv # Output: original URLs + resized URLs
└── resized_images/ # Local cache of processed images
| Script | Description |
|---|---|
check_urls.py |
Verifies that all URLs in processed_images.csv are accessible |
cleanup_csv.py |
Removes duplicates and rows with missing resized URLs |
verify_images.py |
Checks dimensions (600x600) and background color (pure white) |
push_to_github.py |
Pushes project files to your GitHub repository |
- Python — core language
- Pillow (PIL) — image processing and resizing
- Requests — image downloading and GitHub API calls
- GitHub API v3 — hosting for resized images
- GitHub API has rate limits for large volumes of images
- Some websites block automatic downloads (SSL errors or access denied)
- For CSV files with commas in filenames, wrap the URL in double quotes