colorthief

package module
v0.0.0-...-f393563 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 8 Imported by: 1

README

Color Thief (Golang)

Grab the color palette from an image.

Download

go get -u github.com/cascax/colorthief-go

Usage

import "github.com/cascax/colorthief-go"

colors, err := colorthief.GetPaletteFromFile("img/image-1.png", 6)

baseColor, err := colorthief.GetColorFromFile("img/image-1.png")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMaxCubes = 6

Functions

func GetColor

func GetColor(img image.Image) (color.Color, error)

GetColor return the base color from the image

func GetColorFromFile

func GetColorFromFile(imgPath string) (color.Color, error)

GetColorFromFile return the base color from the image file

func GetPalette

func GetPalette(img image.Image, maxCubes int) ([]color.Color, error)

GetPalette return cluster similar colors by the median cut algorithm

func GetPaletteFromFile

func GetPaletteFromFile(imgPath string, maxCubes int) ([]color.Color, error)

GetPaletteFromFile return cluster similar colors from the image file

func PrintColor

func PrintColor(colors []color.Color, filename string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL