Extracting dominant color palette from an image
Go
Permalink
Failed to load latest commit information.
images
.gitignore Initial commit Sep 2, 2014
LICENSE added license information Sep 3, 2014
README.md changed the output format in reverse order Sep 5, 2014
go-colorweave.go

README.md

go-colorweave

Extracting dominant color palette from an image

This program extracts the top N dominant colors from an image and display as output, where N can be set by the user. It uses standard image library, resize library and webcolors library. Along with the colors, the program also shows the percentage of the color in the given image. By default, the code displays the color name using CSS 2.1 specifications, but this can be also changes to CSS 3 colors which has wider variety (140) colors.

By default the program takes the test.jpg file in directory. However, it can be changed to any image file.

With the 2 external packages installed, the code can be executed as following:

go run go-colorweave.go

Example

The following image has been used as example:

The program will give the following output when used agains the image above:

green 26.77%
silver 19.77%
olive 16.79%
grey 14.47%
aqua 11.01%