rgoybiv

package module
v0.0.0-...-9ff1ae5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2015 License: MIT Imports: 7 Imported by: 0

README

rgoybiv

Go port of https://github.com/givp/RoyGBiv.

Note: it does not give the same results.

Documentation

Overview

Package rgoybiv is a port of the python package https://github.com/givp/RoyGBiv

Index

Constants

View Source
const (
	N_QUANTIZED           = 100
	MIN_DISTANCE          = 10.0
	MIN_PROMINENCE        = 0.01
	MIN_SATURATION        = 0.05
	MAX_COLORS            = 5
	BACKGROUND_PROMINENCE = 0.5
)

Variables

This section is empty.

Functions

func GetAverage

func GetAverage(img image.Image) color.Color

GetAverage finds the average colour of an image.

Types

type ColorProminence

type ColorProminence struct {
	Value      color.Color
	Prominence float64
}

type ColorProminences

type ColorProminences []ColorProminence

func (ColorProminences) Len

func (a ColorProminences) Len() int

func (ColorProminences) Less

func (a ColorProminences) Less(i, j int) bool

func (ColorProminences) Swap

func (a ColorProminences) Swap(i, j int)

type Options

type Options struct {
	// start with an adaptive palette of this size
	NQuantized int

	// min distance to consider two colors different
	MinDistance float64

	// ignore if less than this proportion of image
	MinProminence float64

	// ignore if not saturated enough
	MinSaturation float64

	// keep only this many colors
	MaxColors int

	// level of Prominence indicating a bg color
	BackgroundProminence float32
}

type Palette

type Palette struct {
	Colors     ColorProminences
	Background color.Color
}

func GetPalette

func GetPalette(img image.Image, opts *Options) Palette

GetPalette finds a palette of the dominant colours in an image. Various parameters, such as the number of dominant colours to return, are given by the Options.

Directories

Path Synopsis
Package distance implements the CMC(l:c) algorithm for finding the distance between two colours
Package distance implements the CMC(l:c) algorithm for finding the distance between two colours

Jump to

Keyboard shortcuts

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