https://github.com/thomas-bouvier/palette-extractor
Extract the dominant color or a representative color palette from an image
https://github.com/thomas-bouvier/palette-extractor
color color-palette image-processing palette vibrant
Last synced: 10 months ago
JSON representation
Extract the dominant color or a representative color palette from an image
- Host: GitHub
- URL: https://github.com/thomas-bouvier/palette-extractor
- Owner: thomas-bouvier
- License: gpl-3.0
- Created: 2018-05-27T17:12:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-22T18:23:35.000Z (almost 8 years ago)
- Last Synced: 2025-08-23T08:39:33.213Z (10 months ago)
- Topics: color, color-palette, image-processing, palette, vibrant
- Language: Go
- Homepage:
- Size: 395 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
palette-extractor
=================
[](https://goreportcard.com/report/thomas-bouvier/palette-extractor)
[](https://godoc.org/github.com/thomas-bouvier/palette-extractor)
This program extracts the dominant color or a representative color palette from an image.
## Usage
Here's a simple example, where we build a 5 color palette:
```go
package main
import (
"fmt"
"github.com/thomas-bouvier/palette-extractor"
)
func main() {
// Creating the extractor object
extractor := extractor.NewExtractor("image.png", 10)
// Displaying the top 5 dominant colors of the image
fmt.Println(extractor.GetPalette(5))
}
```
You can find [the complete documentation](https://godoc.org/github.com/thomas-bouvier/palette-extractor) on GoDoc.
## Example
The following image has been used for this example:

The program will give the following output when used with the image above:
```
[[234 231 230] [208 24 44] [59 41 37] [158 149 145] [145 126 114]]
```
## Thanks
Many thanks to [Lokesh Dhakar](https://github.com/lokesh) for [his original work](https://github.com/lokesh/color-thief/) and [Shipeng Feng](https://github.com/fengsp) for [his implementation](https://github.com/fengsp/color-thief-py).