{"id":16603108,"url":"https://github.com/mwelwankuta/image-match","last_synced_at":"2025-03-09T12:56:47.717Z","repository":{"id":256798160,"uuid":"856459278","full_name":"mwelwankuta/image-match","owner":"mwelwankuta","description":"a multi-threaded tool for batch renaming images of their appearance  and match in a datasource ","archived":false,"fork":false,"pushed_at":"2024-09-12T16:10:52.000Z","size":5475,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T08:46:00.733Z","etag":null,"topics":["data","openai","typescript","worker-threads"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mwelwankuta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-12T15:57:15.000Z","updated_at":"2024-09-12T16:10:56.000Z","dependencies_parsed_at":"2024-09-13T05:06:43.803Z","dependency_job_id":"6dae0d16-c08c-41ed-a397-c337c0822d7a","html_url":"https://github.com/mwelwankuta/image-match","commit_stats":null,"previous_names":["mwelwankuta/image-match"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwelwankuta%2Fimage-match","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwelwankuta%2Fimage-match/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwelwankuta%2Fimage-match/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwelwankuta%2Fimage-match/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mwelwankuta","download_url":"https://codeload.github.com/mwelwankuta/image-match/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242692348,"owners_count":20170228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","openai","typescript","worker-threads"],"created_at":"2024-10-12T00:47:24.066Z","updated_at":"2025-03-09T12:56:47.660Z","avatar_url":"https://github.com/mwelwankuta.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Image Match\n\nThis project, **Image Match**, is a bulk image renaming tool that uses the OpenAI API to rename images based on a list of possible names provided in a CSV or Excel file. The tool distributes the renaming task across multiple threads, utilizing 80% of the CPU cores available on the user's machine to process images in parallel for faster performance.\n\n## Features\n\n- Rename images in bulk based on names in a CSV or Excel file.\n- Uses OpenAI's API to match images with names.\n- Automatically distributes workload across multiple threads for efficiency.\n- Supports both CSV and Excel files as data sources.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n- **Node.js** (Download from [here](https://nodejs.org/))\n- **OpenAI API Key** (Get it from [OpenAI](https://openai.com/api/))\n\n## Installation\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/mwelwankuta/image-match.git\n   ```\n\n2. **Navigate to the project directory:**\n\n   ```bash\n   cd image-match\n   ```\n\n3. **Install dependencies:**\n\n   ```bash\n   npm install\n   ```\n\n4. **Set up your OpenAI API key:**\n\n   Create a `.env` file in the root directory of the project and add your OpenAI API key:\n\n   ```bash\n   touch .env\n   ```\n\n   Inside `.env`, add:\n\n   ```\n   OPENAI_API_KEY=your-openai-api-key\n   ```\n\n   Replace `your-openai-api-key` with your actual API key from OpenAI.\n\n## Project Setup\n\n1. **Organize your files:**\n\n   - **Images**: Place all the images you want to rename inside the `images/` folder.\n   - **Data Source**: Place your CSV or Excel file inside the `data/` folder and rename it to `datasource.csv`. This file should contain the list of possible names that can be matched with your images.\n\n2. **Data File Format:**\n\n   - The data file should be either a `.csv` or `.xlsx` file.\n   - One of the columns in this file should contain the names you want to use for renaming the images.\n\n## Running the Tool\n\nOnce everything is set up, you can run the tool with the following command:\n\n```bash\nnode -r ts-node/register ./src/index.ts -c \"\u003cYourColumnName\u003e\"\n```\n\nReplace `\u003cYourColumnName\u003e` with the name of the column from your CSV or Excel file that contains the names for renaming the images.\n\n### Example\n\n```bash\nnode -r ts-node/register ./src/index.ts -c \"Product Name\"\n```\n\n### Output\n\n- The tool will process the images, and renamed images will be saved in the `dist` folder.\n- The console will display the renaming progress, including whether each image found a match in the data source.\n\n## Multithreading\n\nThis tool uses Node.js's `worker_threads` to process images in parallel. It automatically detects 80% of the CPU cores and assigns work accordingly to speed up the renaming process.\n\n## Folder Structure\n\n```bash\nimage-match/\n│\n├── images/             # Folder where you put your original images\n│\n├── dist/               # Folder where renamed images will be saved\n│\n├── data/\n│   └── datasource.csv  # The CSV or Excel file with the list of names\n│\n├── src/\n│   └── index.ts        # Main script\n│\n├── .env                # API Key configuration (not in the repo, you'll create this)\n│\n└── package.json        # Node.js dependencies and scripts\n```\n\n## Troubleshooting\n\n- **Missing OpenAI API Key**: Ensure your `.env` file contains the correct OpenAI API key.\n- **Invalid Column Name**: Double-check that the column name you provide matches the name exactly as it appears in your CSV or Excel file.\n- **Unsupported File Format**: Ensure that your data file is either `.csv` or `.xlsx`.\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\nFeel free to raise an issue or contribute to the project if you encounter any problems or have suggestions for improvements. Happy coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwelwankuta%2Fimage-match","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmwelwankuta%2Fimage-match","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwelwankuta%2Fimage-match/lists"}