{"id":13748333,"url":"https://github.com/josip/node-colour-extractor","last_synced_at":"2026-01-10T19:43:18.554Z","repository":{"id":1416682,"uuid":"1504821","full_name":"josip/node-colour-extractor","owner":"josip","description":"Extract colour palettes from images 🎨","archived":false,"fork":false,"pushed_at":"2023-05-16T13:15:33.000Z","size":826,"stargazers_count":126,"open_issues_count":4,"forks_count":20,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T02:46:16.992Z","etag":null,"topics":["color-palette-generator","colors","image-processing","nodejs","photos"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/josip.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,"governance":null}},"created_at":"2011-03-21T00:16:52.000Z","updated_at":"2024-10-28T17:23:21.000Z","dependencies_parsed_at":"2023-07-05T15:46:13.910Z","dependency_job_id":null,"html_url":"https://github.com/josip/node-colour-extractor","commit_stats":{"total_commits":13,"total_committers":4,"mean_commits":3.25,"dds":"0.46153846153846156","last_synced_commit":"be5cdf04a2577bce331af641961a660ee0a8ac4b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josip%2Fnode-colour-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josip%2Fnode-colour-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josip%2Fnode-colour-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josip%2Fnode-colour-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josip","download_url":"https://codeload.github.com/josip/node-colour-extractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253234178,"owners_count":21875561,"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":["color-palette-generator","colors","image-processing","nodejs","photos"],"created_at":"2024-08-03T07:00:39.262Z","updated_at":"2025-05-09T10:32:23.107Z","avatar_url":"https://github.com/josip.png","language":"Rust","readme":"\u003e ℹ️ For GraphicsMagick version please see tag [v0.2.1](https://github.com/josip/node-colour-extractor/tree/v0.2.1).\n\n---\n\n[![CI](https://github.com/josip/node-colour-extractor/actions/workflows/CI.yml/badge.svg)](https://github.com/josip/node-colour-extractor/actions/workflows/CI.yml)\n\n# colour-extractor\n\nExtracts colour palettes from photos using k-means clustering in LAB colour space.\n\n![sample 1](./samples/sample1.png)\n![sample 2](./samples/sample2.png)\n![sample 3](./samples/sample3.png)\n\n## Installation\n\nIs as simple as with any other Node.js module:\n\n    $ npm install @colour-extractor/colour-extractor\n\nNote: This module contains native Rust libraries. Please open an issue if your platform isn't supported.\n\n## Usage\n\n`colour-extractor` exports two functions:\n\n```js\nconst { topColours, topColoursHex } = require('@colour-extractor/colour-extractor');\nconst colours = await topColours('./photos/cats/tigre.jpg');\nconsole.log(colours);\n// =\u003e [ [158, 64, 75], ... ]\n```\n\n`topColours` function needs a path to your image (see below for supported formats) and it resolves to an `Array` containing RGB triplet for each prominent colour:\n\n```json\n[\n  [46, 70, 118],\n  [0, 0, 2],\n  [12, 44, 11]\n]\n```\n\n`topColoursHex` on the other hand returns hex codes (with `#` included):\n\n```js\nconst hexColours = await topColoursHex('./photos/cats/tigre.jpg');\nconsole.log(hexColours);\n// =\u003e [\"#2e4676\", \"#000002\", \"#0c2c0b\"]\n```\n\n## Supported image formats\n\nAll major image formats are supported, including PNG, JPG and WebP. Please see [image-rs's documentation](https://github.com/image-rs/image/blob/master/README.md#supported-image-formats) for a full list. Note that file extension is used for determining the image type.\n\n## How does it work?\n\nHere's the simplified algorithm:\n\n1. Image is scaled down to 48x48px with a fast nearest-neighbour algorithm.\n2. Colours are grouped into up to 16 clusters using [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering).\n3. Identified clusters are further refined using [CIEDE2000 colour distance](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000), removing any duplicates.\n\n## Licence\n\ncolour-extractor is published under MIT license.\n\nPhotos used the examples above can be found on Unsplash:\n\n  * https://unsplash.com/photos/7QaYj09Wbhs\n  * https://unsplash.com/photos/pPRT4CLykp8\n  * https://unsplash.com/photos/ttF84ygvliI\n","funding_links":[],"categories":["CoffeeScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosip%2Fnode-colour-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosip%2Fnode-colour-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosip%2Fnode-colour-extractor/lists"}