Image Downloader CLI is a command-line tool to download and store images based on user-defined search queries. The tool is designed using Clean Architecture principles for maintainability and modularity, and it supports efficient, concurrent downloading of images.
- Asynchronous Image Downloading
- Image Processing with Resizing
- PostgreSQL Integration
- Google Image Search API Integration
- Dockerized Deployment
- Python 3.10 or higher
- Docker (for containerization)
- PostgreSQL (setup via Docker)
- Google API Key and Custom Search Engine ID
-
Clone the Repository
git clone https://github.com/yourusername/image-downloader-cli.git cd image-downloader-cli
-
Environment Variables
Create a
.env
file in the root directory with the necessary configuration:# Google API GOOGLE_API_KEY=your_google_api_key GOOGLE_CSE_ID=your_google_cse_id # PostgreSQL POSTGRES_USER=your_postgres_username POSTGRES_PASSWORD=your_postgres_password POSTGRES_DB=your_postgres_database POSTGRES_HOST=postgres POSTGRES_PORT=5432 # Image Processing MAX_IMAGE_SIZE=800,600
-
Install Dependencies
If running locally:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Docker Setup
Build the Docker image and run services using Docker Compose:
docker-compose up --build
Run:
python main.py --query "cute kittens" --max-results 10
docker-compose run --rm image_downloader --query "turtle" --max-results 20