The Central Go Modules Repository

To use GoCenter:
export GOPROXY=https://gocenter.io
0
Stars
MIT
License
4
Downloads
January 1st 0001
Last Modified
Version:
Loading...

Coloris (beta) Go Report Card Docs License

go get bitbucket.org/briiC/coloris

Process image to get most used colors.
And return color names that are closest to original colors.
By default skips Black, White and true Gray (#808080) color.

Can be used different color palettes for final color list:

  • Palette_ColorNames3
  • Palette_ColorNames12default
  • Palette_ColorNames26
  • Palette_ColorNamesMAXvery slow for now

Example

#!go

    // Collect colors
    clist := coloris.AllColors("path/to/image.jpg", nil)

    // Print color info
    for _, c := range clist {
        // c.Name       - closest color name
        // c.NameHex    - closest color hex code
        // c.Count      - color pixel count
        // c.Percents   - color usage in image

        fmt.Println(c.Name, c.Percents) // Blue 20%

    }

Also can use these functions

#!go

    // Get only top 3 colors
    clist := coloris.TopColors("path/to/image.jpg", 3, nil)

    // Get 3 least used colors
    clist := coloris.TopColors("path/to/image.jpg", -3, nil)

    // ONE most used color
    clr := coloris.DominantColor("path/to/image.jpg", nil)


Demo

Demo

© Photo by refreshment_66https://www.flickr.com/photos/15574096@N00/28025734441/
© Photo by Sarah Jhttps://www.flickr.com/photos/sarahsj/28102649675/
© Photo by GLOBAL 2000https://www.flickr.com/photos/global2000/27488230333/

Dependency and Thanks

**Color names ** for Palette_ColorNamesMAX palette – http://chir.ag/projects/name-that-color/
Color functionshttps://github.com/lucasb-eyer/go-colorful

Bugs & TODO’s

  • Using Palette_ColorNamesMAX is too slow
  • Need more tests for code coverage 100%