{"id":26851342,"url":"https://github.com/hect1k/cpig","last_synced_at":"2025-10-09T22:11:43.476Z","repository":{"id":267114686,"uuid":"900248290","full_name":"hect1k/cpig","owner":"hect1k","description":"CPIG is a simple C-based program designed to generate a color palette from an image file.","archived":false,"fork":false,"pushed_at":"2025-03-25T04:52:40.000Z","size":111,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T18:24:25.547Z","etag":null,"topics":["c","image-processing","open-source"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hect1k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2024-12-08T09:24:56.000Z","updated_at":"2025-03-25T04:52:43.000Z","dependencies_parsed_at":"2024-12-08T13:27:47.557Z","dependency_job_id":"e421003c-0436-45f5-9622-4d2826ae1f00","html_url":"https://github.com/hect1k/cpig","commit_stats":null,"previous_names":["nnisarggada/c_color","hect1k/cpig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hect1k/cpig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hect1k%2Fcpig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hect1k%2Fcpig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hect1k%2Fcpig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hect1k%2Fcpig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hect1k","download_url":"https://codeload.github.com/hect1k/cpig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hect1k%2Fcpig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002128,"owners_count":26083307,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","image-processing","open-source"],"created_at":"2025-03-30T22:28:47.732Z","updated_at":"2025-10-09T22:11:43.460Z","avatar_url":"https://github.com/hect1k.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPIG - Color Palette Inference Generator\n\n`cpig` is a simple C-based program designed to generate a color palette from an image file. It uses the K-means clustering algorithm to extract dominant colors from an image and saves them in a specified format. This tool can be useful for designers, developers, and anyone who wants to create a color palette based on an image.\n\n![CPIG Banner](https://nnisarg.in/images/projects/cpig.jpg)\n\n## Table of Contents\n\n- [Features](#features)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Building](#building)\n  - [Running the Program](#running-the-program)\n- [Usage](#usage)\n  - [Command-Line Arguments](#command-line-arguments)\n  - [Example Usage](#example-usage)\n- [To-Do](#todo)\n- [License](#license)\n- [Contributing](#contributing)\n\n## Features\n\n- Extracts a user-defined number of dominant colors from an image.\n- Outputs the extracted palette in hexadecimal color format.\n- Supports various image formats (JPEG, PNG, etc.).\n- Can save the generated palette to a text file.\n\n## Getting Started\n\n### Prerequisites\n\n- C Compiler (GCC or compatible)\n- [STB Image](https://github.com/nothings/stb) library to load images\n- `make` for building the project\n\n### Installation\n\n1. Clone the repository to your local machine:\n\n   ```bash\n   git clone https://github.com/hect1k/cpig.git\n   cd cpig\n   ```\n\n2. Install the necessary dependencies (STB Image library is included with the project):\n\n   No external dependencies are required aside from a C compiler.\n\n### Building\n\nTo build the project, run the following command in the terminal:\n\n```bash\nmake clean install\n```\n\nThis will compile the project and generate the `cpig` binary.\n\n### Running the Program\n\nAfter building the program, you can run it using the following command:\n\n```bash\n./cpig image_path [options]\n\nOptions:\n  -c, --colors   Number of colors in the palette (default: 5)\n  -v, --verbose  Enable verbose output\n  -h, --help     Print this help message\n```\n\n## Usage\n\n### Command-Line Arguments\n\n- `image_file`: The path to the image file from which you want to extract the color palette.\n- `--colors \u003cnumber\u003e` or `-c \u003cnumber\u003e`: Specify the number of colors to extract (default: 5).\n- `--verbose` or `-v`: Enable verbose output.\n- `--help` or `-h`: Print this help message.\n\n### Example Usage\n\n1. **Generate a palette with the default settings (5 colors) and print it to the console:**\n\n   ```bash\n   ./cpig input.jpg\n   ```\n\n2. **Generate a palette with 6 colors:**\n\n   ```bash\n   ./cpig input.jpg --colors 6\n   ```\n\n3. **Generate a palette with 10 colors and enable verbose output:**\n\n   ```bash\n   ./cpig input.jpg -c 10 -v\n   ```\n\nThe generated palette will be in hexadecimal format, like:\n\n```txt\n#A1B2C3\n#D4E5F6\n#F1F2F3\n...\n```\n\n### Notes\n\n- The program uses the K-means clustering algorithm to determine the most prominent colors in the image. The number of colors specified is the number of clusters in the K-means algorithm.\n- The program automatically uses the `stb_image` library to load various image formats, including `.jpg`, `.png`, and `.bmp`.\n\n## TODO\n\n- [ ] Optimize color generation.\n- [ ] Add support for multiple output formats.\n- [ ] Add support for image types.\n\n## License\n\nThis project is licensed under the GNU General Public License v3 - see the [LICENSE](LICENSE.md) file for details.\n\n## Contributing\n\nWe welcome contributions from the community! Please read our [Contribution Guidelines](CONTRIBUTING.md) for details on how to get started.\n\n## Code of Conduct\n\nWe maintain a [Code of Conduct](CODE_OF_CONDUCT.md) to ensure a welcoming and inclusive environment for all contributors and users.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhect1k%2Fcpig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhect1k%2Fcpig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhect1k%2Fcpig/lists"}