{"id":21815426,"url":"https://github.com/tooleks/php-avg-color-picker","last_synced_at":"2025-04-14T00:42:33.555Z","repository":{"id":45749028,"uuid":"91172342","full_name":"tooleks/php-avg-color-picker","owner":"tooleks","description":"The PHP Average Color Picker Package","archived":false,"fork":false,"pushed_at":"2022-07-15T18:06:22.000Z","size":273,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T14:52:45.739Z","etag":null,"topics":["average","avg","color","hex","php","picker","rgb"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/tooleks/php-avg-color-picker","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/tooleks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-13T12:21:40.000Z","updated_at":"2023-06-17T19:17:30.000Z","dependencies_parsed_at":"2022-08-29T11:20:26.282Z","dependency_job_id":null,"html_url":"https://github.com/tooleks/php-avg-color-picker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tooleks%2Fphp-avg-color-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tooleks%2Fphp-avg-color-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tooleks%2Fphp-avg-color-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tooleks%2Fphp-avg-color-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tooleks","download_url":"https://codeload.github.com/tooleks/php-avg-color-picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804718,"owners_count":21164127,"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":["average","avg","color","hex","php","picker","rgb"],"created_at":"2024-11-27T15:18:51.406Z","updated_at":"2025-04-14T00:42:33.529Z","avatar_url":"https://github.com/tooleks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The PHP Average Color Picker Library\n\nThe package provides the library for picking an average color from the given image. Currently it supports `image/png`, `image/jpeg`, `image/gif` image MIME types.\n\n## Example\n\n### Input - The Image Path\n\n[The Image Path](https://github.com/tooleks/php-avg-color-picker/tree/master/resources/input.jpg)  \n![Input](https://raw.githubusercontent.com/tooleks/php-avg-color-picker/master/resources/input.jpg)\n\n### Output - The Image Average Color\n\n[The Image Average Color](https://github.com/tooleks/php-avg-color-picker/tree/master/resources/output.jpg)  \n![Output](https://raw.githubusercontent.com/tooleks/php-avg-color-picker/master/resources/output.jpg)\n\n## Requirements\n\n\"php\": \"^7.0\",\n\"ext-mbstring\": \"\\*\",\n\"ext-gd\": \"\\*\"\n\n## Installation\n\n### Package Installation\n\nExecute the following command to get the latest version of the package:\n\n```shell\ncomposer require tooleks/php-avg-color-picker\n```\n\n## Usage Examples\n\n```php\n\u003c?php\n\nuse Tooleks\\Php\\AvgColorPicker\\Gd\\AvgColorPicker;\n\n$imageAvgRgbColor = (new AvgColorPicker)-\u003egetImageAvgRgbByPath($imagePath);\n// or\n$imageAvgRgbColor = (new AvgColorPicker)-\u003egetImageAvgRgbByResource($gdImageResource);\n// or\n$imageAvgRgbColor = (new AvgColorPicker)-\u003egetImageAvgRgb($imagePath);\n// or\n$imageAvgRgbColor = (new AvgColorPicker)-\u003egetImageAvgRgb($gdImageResource);\n\n// The `$imageAvgRgbColor` variable contains the average color of the given image in RGB format (array)[255, 255, 255].\n```\n\n```php\n\u003c?php\n\nuse Tooleks\\Php\\AvgColorPicker\\Gd\\AvgColorPicker;\n\n$imageAvgHexColor = (new AvgColorPicker)-\u003egetImageAvgHexByPath($imagePath);\n// or\n$imageAvgHexColor = (new AvgColorPicker)-\u003egetImageAvgHexByResource($gdImageResource);\n// or\n$imageAvgHexColor = (new AvgColorPicker)-\u003egetImageAvgHex($imagePath);\n// or\n$imageAvgHexColor = (new AvgColorPicker)-\u003egetImageAvgHex($gdImageResource);\n\n// The `$imageAvgHexColor` variable contains the average color of the given image in HEX format (string)\"#fffff\".\n```\n\nYou can use the calculated value to show the average image color in its container before the image is loaded.\n\n```php\n\u003cdiv style=\"background-color: \u003c?= $imageAvgHexColor ?\u003e; width: \u003c?= $imageWidth ?\u003e; height: \u003c?= $imageHeight ?\u003e;\"\u003e\n    \u003cimg src=\"/url/to/the/image.(jpg|jpeg|png|gif)\" alt=\"\"\u003e\n\u003c/div\u003e\n```\n\n## Tests\n\nExecute the following command to run tests:\n\n```shell\n./vendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftooleks%2Fphp-avg-color-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftooleks%2Fphp-avg-color-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftooleks%2Fphp-avg-color-picker/lists"}