{"id":28956425,"url":"https://github.com/fredtux/photocolornames","last_synced_at":"2026-04-17T04:32:44.415Z","repository":{"id":62507194,"uuid":"96823654","full_name":"fredtux/PhotoColorNames","owner":"fredtux","description":"Heterogeneous libraries integrator for image color extraction and naming","archived":false,"fork":false,"pushed_at":"2020-08-26T20:46:17.000Z","size":54,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T21:02:25.427Z","etag":null,"topics":["color-extraction","color-namer","composer","image-analysis","packagist","php-color-extraction","php-color-name","php-color-namer","php-image","php-library"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fredtux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-10T21:38:32.000Z","updated_at":"2020-08-26T20:46:19.000Z","dependencies_parsed_at":"2022-11-02T12:45:51.925Z","dependency_job_id":null,"html_url":"https://github.com/fredtux/PhotoColorNames","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fredtux/PhotoColorNames","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2FPhotoColorNames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2FPhotoColorNames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2FPhotoColorNames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2FPhotoColorNames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredtux","download_url":"https://codeload.github.com/fredtux/PhotoColorNames/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2FPhotoColorNames/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281786825,"owners_count":26561424,"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-30T02:00:06.501Z","response_time":61,"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":["color-extraction","color-namer","composer","image-analysis","packagist","php-color-extraction","php-color-name","php-color-namer","php-image","php-library"],"created_at":"2025-06-23T21:01:52.673Z","updated_at":"2025-10-30T10:11:06.322Z","avatar_url":"https://github.com/fredtux.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhotoColorNames\n**Heterogeneous libraries integrator for image color extraction and naming**\n\n## Usage\nA simple example with comments\n```php\n\u003c?php\n### OPTIONAL (depending on settings) ###\n// Include autoload - may not be necessary if it has already been done\ninclude __DIR__ . '/vendor/autoload.php';\n\n// Used classes\n/// For color extraction\nuse PhotoColorNames\\PhotoColors\\PhotoColorFactory;\nuse PhotoColorNames\\PhotoColors\\PhotoColorOptions;\n/// For color naming\nuse PhotoColorNames\\ColorNames\\ColorNamesFactory;\nuse PhotoColorNames\\ColorNames\\NamePool;\nuse PhotoColorNames\\NameColor;\n### END OF OPTIONAL ###\n\n### MAIN ###\n// Extract colors\n/// Use the factory to retrieve a new object for color extraction\n$photoColors = PhotoColorFactory::getColorExtractor('ColorThief'); // Has to be installed via composer - 'GetMostCommonColors' can be used instead\n/// Specify options - the most important is the file path\n$photoColorOptions = new PhotoColorNames\\PhotoColors\\PhotoColorExtractorOptions(__DIR__ . '/test/images/test.jpg'); // Assuming there is a test image at this path\n// Manually set each option, or set all options except the file path to their default value\n$photoColorOptions-\u003esetDefaultOptions();\n\n// Name the colors\n/// Use the factory to retrieve a new object for color naming\n$nameGiver = ColorNamesFactory::getColorNameGiver('ntc');\n/// Use a list of names\n$nameList = NamePool::getNtcNames();\n\n// Construct object using the 4 variables declared before\n$nameColor = new NameColor($photoColors, $photoColorOptions, $nameGiver, $nameList);\n\n// Use the newly created object to get the names of the most frequently used colors in the file\n$x = $nameColor-\u003egetNamesOfFrequentlyUsedColors();\n### END OF MAIN ###\n\n// Print result (not part of MAIN because it's not necessary)\nprint_r($x);\n```\n## Adding new libraries\n### By Source\n#### Composer\nJust add it to composer.json and install. Composer will integrate it easily into the project.\n\n[Packagist project](https://packagist.org/packages/fredtux/photo-color-names)\n#### Non-composer\nIt is recommended, though not enforced, to place it into the **NoComposer** folder under the **ColorNames** or **PhotoColors** folders depending on the purpose of the new library.\n\n### By Type\n#### Color Extractors\n##### Libraries\n1. An adapter must be created in src/PhotoColors/Adapters\n2. The adapter must implement iPhotoColorExtractor\n   - has a function called **getColors**\n   - has 1 parameter\n     - **$photoColorExtractorOptions** of type **PhotoColorExtractorOptions** \n   - implements all the logic necessary to issue the same type of results like the examples from 5 (no return type enforced since it's designed to run on PHP \u003e= 5.6)\n3. The action of constructing an object of the adapter's type must be placed in a new case under the switch from the method **getColorExtractor** from **PhotoColorFactory**\n4. The new library can be used by creating an object from the factory\n   ```php\n   PhotoColorFactory::getColorExtractor('ColorExtractorLibrary');\n   ```\n5. Examples\n   - PhotoColorNames\\PhotoColors\\Adapters\\ColorThiefAdapter\n   - GetMostCommonColorsAdapter\n#### Extractor options\nNew extractor options classes can be specified, but have to be paired with the color extractor class\n1\n#### Color Names\n##### Libraries\n1. An adapter must be created in src/ColorNames/Adapters\n2. The adapter must implement iPhotoColorNamesGiver\n   - has a function called **getName**\n   - has 2 parameters\n     - **$colorName** of type **ColorData** \n     - **$nameList** of type **array**\n   - implements all the logic necessary to issue the same type of results like the example from 5 (no return type enforced since it's designed to run on PHP \u003e= 5.6)\n3. The action of constructing an object of the adapter's type must be placed in a new case under the switch from the method **getColorNameGiver** from **ColorNamesFactory**\n4. The new library can be used by creating an object from the factory\n   ```php\n   ColorNamesFactory::getColorNameGiver('ColorNamingLibrary');\n   ```\n5. Examples\n   - PhotoColorNames\\ColorNames\\Adapters\\NtcAdapter\n##### Name lists\nIt is recommended, though not enforced, to add new name lists to **NamePool** as a static method that returns an array which has the key as the color's RGB hex code and the value as an array containing the name\n\n## License\nThis project is released under MIT license.  \nIn this project there are algorithms from various sources. I do my best to respect the code license and give credit to the owner, but if you think your license has been breached, please feel free to open an issue and I'll solve it as soon as possible. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredtux%2Fphotocolornames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredtux%2Fphotocolornames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredtux%2Fphotocolornames/lists"}