# 📸 Image Scraper for Windows

Version: 0.08 | Developed by: Lab53

A command-line tool to scrape images from Google Custom Search API.

## 📥 Installation

1. Download the ImageScraperSetup.exe file.
2. Run the installer and follow the setup instructions.
3. The application will be installed at:

       C:\Program Files (x86)\ImageScraper\

## 🌍 How to Get a Google API Key

Follow these steps to obtain a Google Custom Search API Key:

1. Go to the Google Cloud Console.
2. Log in with your Google account.
3. Click **Select a Project** (or create a new project).
4. In the left menu, go to APIs & Services > Library.
5. Search for Custom Search API and click **Enable**.
6. Once enabled, go to APIs & Services > Credentials.
7. Click **Create Credentials > API Key**.
8. Copy the generated API key and paste it into config.yaml:

    google_api_key: "YOUR_GOOGLE_API_KEY"

## 🔍 How to Get the Custom Search Engine ID (CX)

Follow these steps to create a search engine ID (CX):

1. Go to Google Programmable Search Engine.
2. Click **Get Started**.
3. Under **Sites to Search**, select **Search the entire web**.
4. Click **Create**.
5. Once created, go to Setup > Search Engine ID.
6. Copy the **CX ID** and paste it into config.yaml:

    cx: "YOUR_CUSTOM_SEARCH_CX"

## ▶️ How to Use

#### Option 1: Run from Start Menu

Search for Image Scraper in the Windows Start Menu and click to open.

#### Option 2: Run from Command Prompt

Open Command Prompt (`cmd`) and run:

    cd "C:\Program Files (x86)\ImageScraper"

    image-scraper-windows.exe

## ⚙️ Configuration

Edit the config.yaml file located at:

    C:\Program Files (x86)\ImageScraper\config.yaml

#### Example Configuration:

    google_api_key: "YOUR_GOOGLE_API_KEY"
    cx: "YOUR_CUSTOM_SEARCH_CX"
    search_query: "Bonsai Tree"
    max_images: 50
    download_folder: "images"

#### Change the Search Term:

To search for "Sunset Wallpapers", modify the config file:

    search_query: "Sunset Wallpapers"

#### Increase Image Downloads:

To download 100 images instead of 50:

    max_images: 100

## 📂 Where Are Images Saved?

Images are saved inside the images folder:

    C:\Program Files (x86)\ImageScraper\images

For example, searching for "Bonsai Tree" will save images in:

    C:\Program Files (x86)\ImageScraper\images\Bonsai_Tree\

## ❌ Troubleshooting

Command Prompt Closes Immediately?

Run the program from `cmd` instead:

    cd "C:\Program Files (x86)\ImageScraper"

    image-scraper-windows.exe

No Images Downloaded?

- Check if the API key is correct in `config.yaml`.
- Ensure the search term is correctly set.
- Check your internet connection.

Some Images Fail to Download?

The app automatically skips failed downloads and moves to the next image.

## 🔄 Uninstalling

To uninstall, follow these steps:

1. Open Control Panel > Programs and Features.
2. Find Image Scraper and click Uninstall.